geoshell
Version:
A CLI to fetch real-time geo-data from your terminal
36 lines (31 loc) • 695 B
JavaScript
/**
* Custom error classes
*/
class GeoShellError extends Error {
constructor(message) {
super(message);
this.name = this.constructor.name;
Error.captureStackTrace(this, this.constructor);
}
}
class CountryNotFound extends GeoShellError {
constructor(message) {
super(message || 'Country not found');
}
}
class LocationNotFound extends GeoShellError {
constructor(message) {
super(message || 'Location not found');
}
}
class APIError extends GeoShellError {
constructor(message) {
super(message || 'API request failed');
}
}
module.exports = {
GeoShellError,
CountryNotFound,
LocationNotFound,
APIError
};