mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-21 02:50:11 +08:00
2f23940152
* refactor(utils): refactor error * refactor(utils): remove default export
18 lines
460 B
TypeScript
18 lines
460 B
TypeScript
class ElementPlusError extends Error {
|
|
constructor(m: string) {
|
|
super(m)
|
|
this.name = 'ElementPlusError'
|
|
}
|
|
}
|
|
|
|
export function throwError(scope: string, m: string): never {
|
|
throw new ElementPlusError(`[${scope}] ${m}`)
|
|
}
|
|
|
|
export function debugWarn(scope: string, message: string): void {
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
// eslint-disable-next-line no-console
|
|
console.warn(new ElementPlusError(`[${scope}] ${message}`))
|
|
}
|
|
}
|