element-plus/packages/utils/error.ts
三咲智子 6503e55277
refactor(utils): migrate utils (#5949)
* refactor(utils-v2): migrate utils

* refactor(utils-v2): migrate utils

* refactor(utils-v2): migrate utils

* refactor(utils): remove

* refactor(utils): rename

* refactor(utils): move EVENT_CODE to constants

* refactor: remove generic
2022-02-11 11:03:15 +08:00

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}`))
}
}