ra-core
Version:
Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React
20 lines (18 loc) • 563 B
text/typescript
class HttpError extends Error {
constructor(
public readonly message,
public readonly status,
public readonly body: any = null
) {
super(message);
Object.setPrototypeOf(this, HttpError.prototype);
this.name = this.constructor.name;
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = new Error(message).stack;
}
this.stack = new Error().stack;
}
}
export default HttpError;