errors.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. const codes = {
  2. '-1': 'unknown error',
  3. '-2': 'need params',
  4. '-20': 'params error',
  5. '-3': 'need query',
  6. '-30': 'query error',
  7. '-4': 'need body',
  8. '-40': 'body error',
  9. '-5': 'need args',
  10. '-50': 'bad args',
  11. '-10': 'data not found',
  12. '-100': 'service fault',
  13. '-500': 'request falut',
  14. '-3000': 'ElasticSearch error',
  15. '-3001': 'ElasticSearch error, index not found',
  16. '400': 'Service encountered an error',
  17. '400-1': 'Function temporarily unavailable',
  18. '401': 'You do not have permission for the current function!',
  19. '401-1': 'User not found',
  20. '401-2': 'Password error',
  21. '401-3': 'No login information detected, please log in again!',
  22. '401-4': 'Account login has expired, please log in again!',
  23. '401-5': 'This account has been logged in elsewhere, please log in again!',
  24. '401-6': 'The user has been disabled',
  25. '401-7': 'Users in the current role are unable to use',
  26. };
  27. const errCodes = {};
  28. const prefix = 'FRAMEERROR_';
  29. for (const key in codes) {
  30. errCodes[`${prefix}${key}`] = codes[key];
  31. }
  32. export default {
  33. test: 'error language is: {locale}',
  34. ...errCodes,
  35. };