mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-12 06:26:16 -08:00
17 lines
479 B
JavaScript
17 lines
479 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) {
|
|
const isFun = typeof condition === 'function';
|
|
if (isFun ? !isFun() : !condition) {
|
|
throw new ArtPlayerError(msg);
|
|
}
|
|
}
|