element-plus/packages/utils/error.ts

15 lines
326 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 warn(scope: string, m: string) {
console.warn(new ElementPlusError(`[${scope}] ${m}`))
2020-08-19 11:05:40 +08:00
}