Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / docs / source / Error.html
diff --git a/docs/source/Error.html b/docs/source/Error.html
new file mode 100644 (file)
index 0000000..91d3444
--- /dev/null
@@ -0,0 +1,85 @@
+<html>\r
+<head>\r
+  <title>The source code</title>\r
+    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
+</head>\r
+<body  onload="prettyPrint();">\r
+    <pre class="prettyprint lang-js"><div id="method-Ext.Element-handleError"></div>/**
+ * Framework-wide error-handler.  Developers can override this method to provide
+ * custom exception-handling.  Framework errors will often extend from the base
+ * Ext.Error class.
+ * @param {Object/Error} e The thrown exception object.
+ */
+Ext.handleError = function(e) {
+    throw e;
+};
+
+<div id="cls-Ext.Error"></div>/**
+ * @class Ext.Error
+ * @extends Error
+ * <p>A base error class. Future implementations are intended to provide more
+ * robust error handling throughout the framework (<b>in the debug build only</b>)
+ * to check for common errors and problems. The messages issued by this class
+ * will aid error checking. Error checks will be automatically removed in the
+ * production build so that performance is not negatively impacted.</p>
+ * <p>Some sample messages currently implemented:</p><pre>
+"DataProxy attempted to execute an API-action but found an undefined
+url / function. Please review your Proxy url/api-configuration."
+ * </pre><pre>
+"Could not locate your "root" property in your server response.
+Please review your JsonReader config to ensure the config-property
+"root" matches the property your server-response.  See the JsonReader
+docs for additional assistance."
+ * </pre>
+ * <p>An example of the code used for generating error messages:</p><pre><code>
+try {
+    generateError({
+        foo: 'bar'
+    });
+}
+catch (e) {
+    console.error(e);
+}
+function generateError(data) {
+    throw new Ext.Error('foo-error', data);
+}
+ * </code></pre>
+ * @param {String} message
+ */
+Ext.Error = function(message) {
+    // Try to read the message from Ext.Error.lang
+    this.message = (this.lang[message]) ? this.lang[message] : message;
+}
+Ext.Error.prototype = new Error();
+Ext.apply(Ext.Error.prototype, {
+    // protected.  Extensions place their error-strings here.
+    lang: {},
+
+    name: 'Ext.Error',
+    <div id="method-Ext.Error-getName"></div>/**
+     * getName
+     * @return {String}
+     */
+    getName : function() {
+        return this.name;
+    },
+    <div id="method-Ext.Error-getMessage"></div>/**
+     * getMessage
+     * @return {String}
+     */
+    getMessage : function() {
+        return this.message;
+    },
+    <div id="method-Ext.Error-toJson"></div>/**
+     * toJson
+     * @return {String}
+     */
+    toJson : function() {
+        return Ext.encode(this);
+    }
+});
+
+</pre>    \r
+</body>\r
+</html>
\ No newline at end of file