elegant-wui-uni
Version:
一个基于Vue3+TS开发的uni-app组件库,提供70+高质量组件,支持暗黑模式、国际化和自定义主题。
24 lines (21 loc) • 664 B
text/typescript
import { isString } from './util'
class WUIError extends Error {
constructor(message: string) {
super(message)
this.name = 'WUIError'
}
}
export function throwError(scope: string, msg: string): never {
throw new WUIError(`[${scope}] ${msg}`)
}
export function debugWarn(err: Error): void
export function debugWarn(scope: string, message: string): void
export function debugWarn(scope: string | Error, message?: string): void {
if (process.env.NODE_ENV !== 'production') {
const error: Error = isString(scope)
? new WUIError(`[${scope}] ${message}`)
: scope
// eslint-disable-next-line no-console
console.warn(error)
}
}