p2p-media-loader-core
Version:
P2P Media Loader core functionality
45 lines • 1.38 kB
JavaScript
/**
* Represents an error that can occur during the request process, with a timestamp for when the error occurred.
* @template T - The specific type of request error.
*/
export class RequestError extends Error {
/**
* Constructs a new RequestError.
* @param type - The specific error type.
* @param message - Optional message describing the error.
*/
constructor(type, message) {
super(message);
Object.defineProperty(this, "type", {
enumerable: true,
configurable: true,
writable: true,
value: type
});
/** Error timestamp. */
Object.defineProperty(this, "timestamp", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.timestamp = performance.now();
}
}
/** Custom error class for errors that occur during core network requests. */
export class CoreRequestError extends Error {
/**
* Constructs a new CoreRequestError.
* @param type - The type of the error, either 'failed' or 'aborted'.
*/
constructor(type) {
super();
Object.defineProperty(this, "type", {
enumerable: true,
configurable: true,
writable: true,
value: type
});
}
}
//# sourceMappingURL=types.js.map