errors.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /**
  2. * DevExtreme (data/errors.js)
  3. * Version: 19.1.16
  4. * Build date: Tue Oct 18 2022
  5. *
  6. * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
  7. * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
  8. */
  9. "use strict";
  10. var errorUtils = require("../core/utils/error");
  11. var coreErrors = require("../core/errors");
  12. var handlers = {};
  13. var errors = errorUtils(coreErrors.ERROR_MESSAGES, {
  14. E4000: "[DevExpress.data]: {0}",
  15. E4001: "Unknown aggregating function is detected: '{0}'",
  16. E4002: "Unsupported OData protocol version is used",
  17. E4003: "Unknown filter operation is used: {0}",
  18. E4004: "The thenby() method is called before the sortby() method",
  19. E4005: "Store requires a key expression for this operation",
  20. E4006: "ArrayStore 'data' option must be an array",
  21. E4007: "Compound keys cannot be auto-generated",
  22. E4008: "Attempt to insert an item with the a duplicated key",
  23. E4009: "Data item cannot be found",
  24. E4010: "CustomStore does not support creating queries",
  25. E4011: "Custom Store method is not implemented or is not a function: {0}",
  26. E4012: "Custom Store method returns an invalid value: {0}",
  27. E4013: "Local Store requires the 'name' configuration option is specified",
  28. E4014: "Unknown data type is specified for ODataStore: {0}",
  29. E4015: "Unknown entity name or alias is used: {0}",
  30. E4016: "The compileSetter(expr) method is called with 'self' passed as a parameter",
  31. E4017: "Keys cannot be modified",
  32. E4018: "The server has returned a non-numeric value in a response to an item count request",
  33. E4019: "Mixing of group operators inside a single group of filter expression is not allowed",
  34. E4020: "Unknown store type is detected: {0}",
  35. E4021: "The server response does not provide the totalCount value",
  36. E4022: "The server response does not provide the groupCount value",
  37. E4023: "Could not parse the following XML: {0}",
  38. W4000: "Data returned from the server has an incorrect structure",
  39. W4001: 'The {0} field is listed in both "keyType" and "fieldTypes". The value of "fieldTypes" is used.',
  40. W4002: "Data loading has failed for some cells due to the following error: {0}"
  41. });
  42. function handleError(error) {
  43. var id = "E4000";
  44. if (error && "__id" in error) {
  45. id = error.__id
  46. }
  47. errors.log(id, error)
  48. }
  49. var errorHandler = null;
  50. var _errorHandler = function(error) {
  51. if (handlers.errorHandler) {
  52. handlers.errorHandler(error)
  53. }
  54. };
  55. handlers = {
  56. errors: errors,
  57. errorHandler: errorHandler,
  58. _errorHandler: _errorHandler
  59. };
  60. module.exports = handlers;