PageRenderTime 53ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/resources/js/ext-3.1.1/docs/source/Error.html

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