@ant-basement/errors
v1.0.4
Published
Basement Error Definition
Downloads
8
Readme
Basement 错误码统一定义
Getting Started
npm install --save @ant-basement/errors
错误列表以及签名
应用错误:
new TenantNotAvailableError(message?: string, errors: any = {})
new SpaceNotFoundError(message?: string, errors: any = {})
new ResourceNotInitializedError(message?: string, errors: any = {})
new DecisionNotFoundError(message?: string, errors: any = {})
new UnauthorizedError(message?: string, errors: any = {})
new ExceedQuotaError(message?: string, errors: any = {})
new ServiceLimitError(message?: string, errors: any = {})
new PolicyDeniedError(message?: string, errors: any = {})
new PolicySyntaxError(message?: string, errors: any = {})
通用错误:
new ValidationError(message?: string, errors: any = {})
new UnsupportedError(message?: string, errors: any = {})
new NotFoundError(message?: string, errors: any = {})
new TimeoutError(message?: string, errors: any = {})
系统/依赖错误:
new InternalServerError(e: Error)
new ConnectionError(e: Error)
new ParseError(e: Error)
最佳实践
try {
throw new NotFoundError('command', { input: 'readme' });
} catch (err) {
const data = err.inspect();
// data.code;
// data.errors;
// data.message;
// data.reference;
}