You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
3.1 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-method-handleError'>/**
  19. </span> * Framework-wide error-handler. Developers can override this method to provide
  20. * custom exception-handling. Framework errors will often extend from the base
  21. * Ext.Error class.
  22. * @param {Object/Error} e The thrown exception object.
  23. * @member Ext
  24. */
  25. Ext.handleError = function(e) {
  26. throw e;
  27. };
  28. <span id='Ext-Error'>/**
  29. </span> * @class Ext.Error
  30. * @extends Error
  31. * &lt;p&gt;A base error class. Future implementations are intended to provide more
  32. * robust error handling throughout the framework (&lt;b&gt;in the debug build only&lt;/b&gt;)
  33. * to check for common errors and problems. The messages issued by this class
  34. * will aid error checking. Error checks will be automatically removed in the
  35. * production build so that performance is not negatively impacted.&lt;/p&gt;
  36. * &lt;p&gt;Some sample messages currently implemented:&lt;/p&gt;&lt;pre&gt;
  37. &quot;DataProxy attempted to execute an API-action but found an undefined
  38. url / function. Please review your Proxy url/api-configuration.&quot;
  39. * &lt;/pre&gt;&lt;pre&gt;
  40. &quot;Could not locate your &quot;root&quot; property in your server response.
  41. Please review your JsonReader config to ensure the config-property
  42. &quot;root&quot; matches the property your server-response. See the JsonReader
  43. docs for additional assistance.&quot;
  44. * &lt;/pre&gt;
  45. * &lt;p&gt;An example of the code used for generating error messages:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
  46. try {
  47. generateError({
  48. foo: 'bar'
  49. });
  50. }
  51. catch (e) {
  52. console.error(e);
  53. }
  54. function generateError(data) {
  55. throw new Ext.Error('foo-error', data);
  56. }
  57. * &lt;/code&gt;&lt;/pre&gt;
  58. * @param {String} message
  59. */
  60. Ext.Error = function(message) {
  61. // Try to read the message from Ext.Error.lang
  62. this.message = (this.lang[message]) ? this.lang[message] : message;
  63. };
  64. Ext.Error.prototype = new Error();
  65. Ext.apply(Ext.Error.prototype, {
  66. // protected. Extensions place their error-strings here.
  67. lang: {},
  68. name: 'Ext.Error',
  69. <span id='Ext-Error-method-getName'> /**
  70. </span> * getName
  71. * @return {String}
  72. */
  73. getName : function() {
  74. return this.name;
  75. },
  76. <span id='Ext-Error-method-getMessage'> /**
  77. </span> * getMessage
  78. * @return {String}
  79. */
  80. getMessage : function() {
  81. return this.message;
  82. },
  83. <span id='Ext-Error-method-toJson'> /**
  84. </span> * toJson
  85. * @return {String}
  86. */
  87. toJson : function() {
  88. return Ext.encode(this);
  89. }
  90. });
  91. </pre>
  92. </body>
  93. </html>