element-plus/packages/utils/error.ts

18 lines
445 B
TypeScript
Raw Normal View History

2020-08-19 11:05:40 +08:00
class ElementPlusError extends Error {
constructor(m: string) {
super(m)
2020-09-14 10:03:33 +08:00
this.name = 'ElementPlusError'
2020-08-19 11:05:40 +08:00
}
}
2020-09-14 10:03:33 +08:00
export default (scope: string, m: string) => {
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}`))
}
2020-08-19 11:05:40 +08:00
}