UNPKG

@musicorum/lastfm

Version:

Fully typed [Last.fm](https://last.fm) api client library written and made for Typescript!

87 lines (85 loc) 3.17 kB
class LastfmError extends Error { response; error; constructor(response) { super(response.message); this.response = response; this.error = response.error; } } /** * Sources: {@link https://lastfm-docs.github.io/api-docs/codes/} and {@link https://www.last.fm/api/errorcodes} */ var LastfmErrorCode; (function (LastfmErrorCode) { /** * This service does not exist */ LastfmErrorCode[LastfmErrorCode["SERVICE_UNAVAILABLE"] = 2] = "SERVICE_UNAVAILABLE"; /** * No method with that name in this package */ LastfmErrorCode[LastfmErrorCode["INVALID_METHOD"] = 3] = "INVALID_METHOD"; /** * You do not have permissions to access the service */ LastfmErrorCode[LastfmErrorCode["AUTHENTICATION_FAILED"] = 4] = "AUTHENTICATION_FAILED"; /** * This service doesn't exist in that format */ LastfmErrorCode[LastfmErrorCode["INVALID_RESPONSE_FORMAT"] = 5] = "INVALID_RESPONSE_FORMAT"; /** * Your request is missing a required parameter */ LastfmErrorCode[LastfmErrorCode["INVALID_PARAMETER"] = 6] = "INVALID_PARAMETER"; /** * Invalid resource specified */ LastfmErrorCode[LastfmErrorCode["INVALID_RESOURCE"] = 7] = "INVALID_RESOURCE"; /** * Most likely the backend service failed. Please try again. */ LastfmErrorCode[LastfmErrorCode["OPERATION_FAILED"] = 8] = "OPERATION_FAILED"; /** * Invalid session key - Please re-authenticate */ LastfmErrorCode[LastfmErrorCode["INVALID_SERSSION_TOKEN"] = 9] = "INVALID_SERSSION_TOKEN"; /** * You must be granted with a valid key by last.fm */ LastfmErrorCode[LastfmErrorCode["INVALID_API_TOKEN"] = 10] = "INVALID_API_TOKEN"; /** * This service is temporary offline. Try again later. */ LastfmErrorCode[LastfmErrorCode["SERVICE_OFFLINE"] = 11] = "SERVICE_OFFLINE"; /** * Invalid method signature supplied */ LastfmErrorCode[LastfmErrorCode["INVALID_SIGNATURE"] = 13] = "INVALID_SIGNATURE"; /** * This token has not been authorized */ LastfmErrorCode[LastfmErrorCode["UNAUTHORIZED_TOKEN"] = 14] = "UNAUTHORIZED_TOKEN"; /** * The service is temporarily unavailable, please try again. */ LastfmErrorCode[LastfmErrorCode["TEMPORARY_ERROR"] = 16] = "TEMPORARY_ERROR"; /** * User requires to be logged in to use this method * This may be caused when trying to get some user's data with restricted privicy */ LastfmErrorCode[LastfmErrorCode["REQUIRES_LOGIN"] = 17] = "REQUIRES_LOGIN"; /** * This application is not allowed to make requests to the web services */ LastfmErrorCode[LastfmErrorCode["API_KEY_SUSPENDED"] = 26] = "API_KEY_SUSPENDED"; /** * This type of request is no longer supported */ LastfmErrorCode[LastfmErrorCode["DEPRECATED"] = 27] = "DEPRECATED"; /** * Your IP has made too many requests in a short period */ LastfmErrorCode[LastfmErrorCode["RATE_LIMIT_EXCEEDED"] = 29] = "RATE_LIMIT_EXCEEDED"; })(LastfmErrorCode || (LastfmErrorCode = {})); export { LastfmError, LastfmErrorCode };