Files
ArtPlayer/packages/artplayer/src/utils/error.js
T
2023-09-01 21:14:10 +08:00

17 lines
431 B
JavaScript

export class ArtPlayerError extends Error {
constructor(message, context) {
super(message);
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, context || this.constructor);
}
this.name = 'ArtPlayerError';
}
}
export function errorHandle(condition, msg) {
if (!condition) {
throw new ArtPlayerError(msg);
}
return condition;
}