spotify-api.js
Version:
A complete node js wrapper of spotify api with oauth support
29 lines (28 loc) • 1.09 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.SpotifyAPIError = void 0;
/**
* This error mostly occurs when the spotify api responses an invalid json format!
* You can view up all the spotify web api responses, request types, etc [here](https://developer.spotify.com/documentation/web-api/)
*/
class SpotifyAPIError extends Error {
/**
* This error mostly occurs when the spotify api responses an invalid json format!
* You can view up all the spotify web api responses, request types, etc [here](https://developer.spotify.com/documentation/web-api/)
*
* @param message Error message or axios response.
*/
constructor(response) {
var _a;
if (typeof response == "string")
super(response);
else {
super(JSON.stringify((_a = response.response) === null || _a === void 0 ? void 0 : _a.data));
this.response = response.response;
}
this.name = 'SpotifyAPIError';
}
;
}
exports.SpotifyAPIError = SpotifyAPIError;
;
;