import './report'; import { APIError, UserValidateError } from '@jolibox/common'; export function formatErrorCode(method: string, code?: number) { return `[${method}]:${code}`; } // 创建APIError异常对象 export const createAPIError = ( error: { code: number; msg: string; type?: string }, params?: { errNo?: number; errMsg?: string } ) => { return new APIError(params?.errMsg ?? error.msg ?? '', error.code, error.type); }; export const createUserValidateAPIError = (msg: string) => { return new UserValidateError(msg); }; export { errorReportEmitter, ErrorData } from './report';