• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

scrogson / oauth2 / 185
96%

Build:
DEFAULT BRANCH: master
Ran 06 Oct 2017 08:05PM UTC
Jobs 5
Files 14
Run time 55s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
185

push

travis-ci

scrogson
Update OAuth2.Client.get_token! errors (#98)

* Update OAuth2.Client.get_token! errors

Updates the `OAuth2.Client.get_token!` function to handle error OAuth2.Response structs. I sent some incomplete data to Facebook Graph and saw this error bubble up:

```
[error] %ArgumentError{message: "raise/1 expects a module name, string or exception as the first argument, got: %OAuth2.Response{body: %{\"error\" => %{\"code\" => 101, \"fbtrace_id\" => \"Eelth+pfiU9\", \"message\" => \"Missing client_id parameter.\", \"type\" => \"OAuthException\"}}, headers: [{\"www-authenticate\", \"OAuth \\\"Facebook Platform\\\" \\\"invalid_client\\\" \\\"Missing client_id parameter.\\\"\"}, {\"access-control-allow-origin\", \"*\"}, {\"pragma\", \"no-cache\"}, {\"cache-control\", \"no-store\"}, {\"x-fb-rev\", \"3349395\"}, {\"content-type\", \"application/json\"}, {\"x-fb-trace-id\", \"Eelth+pfiU9\"}, {\"facebook-api-version\", \"v2.8\"}, {\"expires\", \"Sat, 01 Jan 2000 00:00:00 GMT\"}, {\"x-fb-debug\", \"9GWPCrYAIzlrSnt0iLqP/3E4hdmOJpP7QXxBOXTG2Ew7CloqVwka+HXAjyCTewfTaH0F/sUVkDLMcm7+6jOEEQ==\"}, {\"date\", \"Thu, 05 Oct 2017 15:36:54 GMT\"}, {\"connection\", \"keep-alive\"}, {\"content-length\", \"114\"}], status_code: 400}"}
```

Using `OAuth2.Request.request!` as a model, I added a similar error handling case to `OAuth2.Client.get_token!`. Now the error raised looks like:

```
[error] #PID<0.1063.0> running ExampleOAuth2Web.Endpoint terminated
Server: oauth2.example.dev:80 (http)
Request: POST /
** (exit) an exception was raised:
    ** (OAuth2.Error) Server responded with status: 400

Headers:

www-authenticate: OAuth "Facebook Platform" "invalid_client" "Missing client_id parameter."
access-control-allow-origin: *
pragma: no-cache
cache-control: no-store
x-fb-rev: 3349509
content-type: application/json
x-fb-trace-id: CIc8eDTN/BC
facebook-api-version: v2.8
expires: Sat, 01 Jan 2000 00:00:00 GMT
x-fb-debug: wJzExwqDXtAkHKtBNo4xKE21zBO730qctNXaP... (continued)

6 of 6 new or added lines in 1 file covered. (100.0%)

193 of 203 relevant lines covered (95.07%)

64.21 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
100.0
lib/oauth2/client.ex
Jobs
ID Job ID Ran Files Coverage
1 185.1 06 Oct 2017 08:05PM UTC 0
92.12
Travis Job 185.1
3 185.3 06 Oct 2017 08:05PM UTC 0
90.55
Travis Job 185.3
4 185.4 06 Oct 2017 08:05PM UTC 0
93.03
Travis Job 185.4
5 185.5 06 Oct 2017 08:05PM UTC 0
92.04
Travis Job 185.5
6 185.6 06 Oct 2017 08:05PM UTC 0
92.04
Travis Job 185.6
Source Files on build 185
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #185
  • 6d1808c1 on github
  • Prev Build on master (#176)
  • Next Build on master (#188)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc