typerinth
Version:
A TypeScript library for interacting with the Modrinth API.
25 lines (24 loc) • 686 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiError = void 0;
class ApiError extends Error {
errorName;
errorDescription;
constructor(error, description) {
super(`API error: ${error} - ${description}`);
this.name = 'ApiError';
this.errorName = error;
this.errorDescription = description;
}
/**
* Get the error name and description returned by the API
* @returns The error name and description in an object
*/
getApiError() {
return {
error: this.errorName,
description: this.errorDescription,
};
}
}
exports.ApiError = ApiError;