Commit 50a1c51
authored
bug #941 Throw exception for graphql errors (acrobat)
This PR was merged into the 2.x branch.
Discussion
----------
I noticed that errors from the graphql api didn't throw errors by our ExceptionThrower plugin. That's because the graphql api return HTTP code 200 even when the api had an error.
> The GraphQL spec 6 doesn’t make any mention of HTTP status codes in the case of an error. Additionally, I would suggest that the error you show in your post is an application level error, not an HTTP protocol level error. It’s the same thing as when someone submits a value to an HTML form field that is incorrectly formatted … such as an invalid email address. Your web application returns a 200 HTTP status code because everything is fine at the HTTP protocol level, but displays an error message to the user asking them to supply a valid email address in the form.
See https://github.community/t/github-api-v4-error-returns-200-status-code/14178/2
So I've adjusted the exception thrower to check HTTP 200 responses for grapql errors, with the early return's in the check function the overhead should be minimal.
Commits
-------
820186f Throw exception for graphql errorsFile tree
2 files changed
+59
-0
lines changed- lib/Github/HttpClient/Plugin
- test/Github/Tests/HttpClient/Plugin
2 files changed
+59
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
117 | 119 | | |
118 | 120 | | |
119 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
120 | 156 | | |
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
157 | 180 | | |
158 | 181 | | |
159 | 182 | | |
0 commit comments