分离工具函数

This commit is contained in:
Harvey committed 2019-11-14 11:24:02 +08:00
1 parent 7a84c262da
commit 8ef582f714
22 files changed
+724 -687

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
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;
}