| 123456789101112131415161718192021 |
- enum ErrorCode {
- AuthenticationFailed = 401,
- NoPermission = 403,
- ResourceNotExist = 404,
- }
- function getErrorMessage(code: ErrorCode): string {
- switch (code) {
- case ErrorCode.AuthenticationFailed:
- return '认证失败,无法访问系统资源';
- case ErrorCode.NoPermission:
- return '当前操作没有权限';
- case ErrorCode.ResourceNotExist:
- return '访问资源不存在';
- default:
- return '系统未知错误,请反馈给管理员';
- }
- }
- export {ErrorCode, getErrorMessage}
|