Commit b2311651 authored by Robert Knight's avatar Robert Knight

Document `_getAccessToken` return type

Following PR feedback, document the return type of `_getAccessToken`
explicitly and make the error thrown in the event of a non-2xx response
more informative.
parent e1e43428
...@@ -191,7 +191,7 @@ export default class OAuthClient { ...@@ -191,7 +191,7 @@ export default class OAuthClient {
}); });
if (response.status !== 200) { if (response.status !== 200) {
throw new Error('Request failed'); throw new Error(`Request failed with status ${response.status}`);
} }
return response.json(); return response.json();
...@@ -201,6 +201,7 @@ export default class OAuthClient { ...@@ -201,6 +201,7 @@ export default class OAuthClient {
* Fetch an OAuth access token. * Fetch an OAuth access token.
* *
* @param {Record<string, string>} data - Parameters for form POST request * @param {Record<string, string>} data - Parameters for form POST request
* @return {Promise<TokenInfo>}
*/ */
async _getAccessToken(data) { async _getAccessToken(data) {
// The request to `tokenEndpoint` returns an OAuth "Access Token Response". // The request to `tokenEndpoint` returns an OAuth "Access Token Response".
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment