jkeveren-spotify-api
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -18,4 +18,5 @@ /// <reference types="node" /> | ||
export declare class SpotifyRequestError extends Error { | ||
requestURL: string; | ||
response: SpotifyResponse; | ||
constructor(message: string, response: SpotifyResponse); | ||
constructor(message: string, requestURL: string, response: SpotifyResponse); | ||
} | ||
@@ -22,0 +23,0 @@ export interface SpotifyResponse { |
@@ -109,3 +109,3 @@ "use strict"; | ||
if (response.statusCode != 200) { | ||
throw new SpotifyRequestError("Failed to get tokens for user", response); | ||
throw new SpotifyRequestError("Failed to get tokens for user", url.href, response); | ||
} | ||
@@ -130,6 +130,7 @@ user = new SpotifyUser_1.SpotifyUser(); | ||
__extends(SpotifyRequestError, _super); | ||
function SpotifyRequestError(message, response) { | ||
function SpotifyRequestError(message, requestURL, response) { | ||
var _this = this; | ||
message += " (statusCode: ".concat(response.statusCode, ")"); | ||
_this = _super.call(this, message) || this; | ||
_this.requestURL = requestURL; | ||
_this.response = response; | ||
@@ -136,0 +137,0 @@ return _this; |
@@ -73,3 +73,3 @@ "use strict"; | ||
if (response.statusCode !== 200) { | ||
throw new SpotifyClient_1.SpotifyRequestError("Failed to refresh access token for user", response); | ||
throw new SpotifyClient_1.SpotifyRequestError("Failed to refresh access token for user", url.href, response); | ||
} | ||
@@ -128,3 +128,3 @@ // assign token etc to user | ||
return [3 /*break*/, 8]; | ||
case 7: throw new SpotifyClient_1.SpotifyRequestError("Failed to make request", response); | ||
case 7: throw new SpotifyClient_1.SpotifyRequestError("Failed to make request", url.href, response); | ||
case 8: | ||
@@ -131,0 +131,0 @@ i++; |
{ | ||
"name": "jkeveren-spotify-api", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Promise based Spotify API wrapper that automatically refreshes access tokens", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -52,1 +52,2 @@ # jkeveren-spotify-api | ||
- add integration test for state | ||
- add tests for SpotifyRequestError properties |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
29257
378
53