X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/3789b528d8dd8aad4558e38e22d775bcab1cbd36..refs/heads/master:/docs/output/Ext.Error.js diff --git a/docs/output/Ext.Error.js b/docs/output/Ext.Error.js index c553fd8d..4db80ecb 100644 --- a/docs/output/Ext.Error.js +++ b/docs/output/Ext.Error.js @@ -1,173 +1 @@ -Ext.data.JsonP.Ext_Error({ - "tagname": "class", - "name": "Ext.Error", - "doc": "
A wrapper class for the native JavaScript Error object that adds a few useful capabilities for handling\nerrors in an Ext application. When you use Ext.Error to raise an error from within any class that\nuses the Ext 4 class system, the Error class can automatically add the source class and method from which\nthe error was raised. It also includes logic to automatically log the eroor to the console, if available,\nwith additional metadata about the error. In all cases, the error will always be thrown at the end so that\nexecution will halt.
\n\nExt.Error also offers a global error handling method that can be overridden in order to\nhandle application-wide errors in a single spot. You can optionally ignore errors altogether,\nalthough in a real application it's usually a better idea to override the handling function and perform\nlogging or some other method of reporting the errors in a way that is meaningful to the application.
\n\nAt its simplest you can simply raise an error as a simple string from within any code:
\n\nExt.Error.raise('Something bad happened!');\n
\n\nIf raised from plain JavaScript code, the error will be logged to the console (if available) and the message\ndisplayed. In most cases however you'll be raising errors from within a class, and it may often be useful to add\nadditional metadata about the error being raised. The raise method can also take a config object.\nIn this form the msg
attribute becomes the error description, and any other data added to the config gets\nadded to the error object and, if the console is available, logged to the console for inspection.
Ext.define('Ext.Foo', {\n doSomething: function(option){\n if (someCondition === false) {\n Ext.Error.raise({\n msg: 'You cannot do that!',\n option: option, // whatever was passed into the method\n 'error code': 100 // other arbitrary info\n });\n }\n }\n});\n
\n\nIf a console is available (that supports the console.dir
function) you'll see console output like:
An error was raised with the following data:\noption: Object { foo: \"bar\"}\n foo: \"bar\"\nerror code: 100\nmsg: \"You cannot do that!\"\nsourceClass: \"Ext.Foo\"\nsourceMethod: \"doSomething\"\n\nuncaught exception: You cannot do that!\n
\n\nAs you can see, the error will report exactly where it was raised and will include as much information as the\nraising code can usefully provide.
\n\nIf you want to handle all application errors globally you can simply override the static handle method\nand provide whatever handling logic you need. If the method returns true then the error is considered handled\nand will not be thrown to the browser. If anything but true is returned then the error will be thrown normally.
\n\nExt.Error.handle = function(err) {\n if (err.someProperty == 'NotReallyAnError') {\n // maybe log something to the application here if applicable\n return true;\n }\n // any non-true return value (including none) will cause the error to be thrown\n}\n
\n\nCreate a new Error object
\n", - "extends": "Error", - "mixins": [ - - ], - "alternateClassNames": [ - - ], - "xtype": null, - "author": "Brian MoeskauThe error message string, or an object containing the\nattribute \"msg\" that will be used as the error message. Any other data included in\nthe object will be applied to the error instance and logged to the browser console, if available.
\n", - "optional": false - } - ], - "return": { - "type": "void", - "doc": "\n" - }, - "private": false, - "static": false, - "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Error.js", - "linenr": 209, - "html_filename": "Error.html", - "href": "Error.html#Ext-Error-method-constructor", - "shortDoc": "\n" - }, - { - "tagname": "method", - "name": "handle", - "member": "Ext.Error", - "doc": "Globally handle any Ext errors that may be raised, optionally providing custom logic to\nhandle different errors individually. Return true from the function to bypass throwing the\nerror to the browser, otherwise the error will be thrown and execution will halt.
\n\nExt.Error.handle = function(err) {\n if (err.someProperty == 'NotReallyAnError') {\n // maybe log something to the application here if applicable\n return true;\n }\n // any non-true return value (including none) will cause the error to be thrown\n}\n
\n",
- "params": [
- {
- "type": "Ext.Error",
- "name": "err",
- "doc": "The Ext.Error object being raised. It will contain any attributes\nthat were originally raised with it, plus properties about the method and class from which\nthe error originated (if raised from a class that uses the Ext 4 class system).
\n", - "optional": false - } - ], - "return": { - "type": "void", - "doc": "\n" - }, - "private": false, - "static": true, - "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Error.js", - "linenr": 180, - "html_filename": "Error.html", - "href": "Error.html#Ext-Error-method-handle", - "shortDoc": "Globally handle any Ext errors that may be raised, optionally providing custom logic to\nhandle different errors indiv..." - }, - { - "tagname": "method", - "name": "raise", - "member": "Ext.Error", - "doc": "Raise an error that can include additional data and supports automatic console logging if available.\nYou can pass a string error message or an object with the msg
attribute which will be used as the\nerror message. The object can contain any other name-value attributes (or objects) to be logged\nalong with the error.
Note that after displaying the error message a JavaScript error will ultimately be thrown so that\nexecution will halt.
\n\nExt.Error.raise('A simple string error message');\n\n// or...\n\nExt.define('Ext.Foo', {\n doSomething: function(option){\n if (someCondition === false) {\n Ext.Error.raise({\n msg: 'You cannot do that!',\n option: option, // whatever was passed into the method\n 'error code': 100 // other arbitrary info\n });\n }\n }\n});\n
\n",
- "params": [
- {
- "type": "String/Object",
- "name": "err",
- "doc": "The error message string, or an object containing the\nattribute \"msg\" that will be used as the error message. Any other data included in\nthe object will also be logged to the browser console, if available.
\n", - "optional": false - } - ], - "return": { - "type": "void", - "doc": "\n" - }, - "private": false, - "static": true, - "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Error.js", - "linenr": 117, - "html_filename": "Error.html", - "href": "Error.html#Ext-Error-method-raise", - "shortDoc": "Raise an error that can include additional data and supports automatic console logging if available.\nYou can pass a s..." - }, - { - "tagname": "method", - "name": "toString", - "member": "Ext.Error", - "doc": "Provides a custom string representation of the error object. This is an override of the base JavaScript\nObject.toString
method, which is useful so that when logged to the browser console, an error object will\nbe displayed with a useful message instead of [object Object]
, the default toString
result.
The default implementation will include the error message along with the raising class and method, if available,\nbut this can be overridden with a custom implementation either at the prototype level (for all errors) or on\na particular error instance, if you want to provide a custom description that will show up in the console.
\n", - "params": [ - - ], - "return": { - "type": "String", - "doc": "The error message. If raised from within the Ext 4 class system, the error message\nwill also include the raising class and method names, if available.
\n" - }, - "private": false, - "static": false, - "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Error.js", - "linenr": 228, - "html_filename": "Error.html", - "href": "Error.html#Ext-Error-method-toString", - "shortDoc": "Provides a custom string representation of the error object. This is an override of the base JavaScript\nObject.toStri..." - } - ], - "property": [ - { - "tagname": "property", - "name": "ignore", - "member": "Ext.Error", - "type": "Boolean", - "doc": "Static flag that can be used to globally disable error reporting to the browser if set to true\n(defaults to false). Note that if you ignore Ext errors it's likely that some other code may fail\nand throw a native JavaScript error thereafter, so use with caution. In most cases it will probably\nbe preferable to supply a custom error handling function instead.
\n\nExt.Error.ignore = true;\n
\n",
- "private": false,
- "static": true,
- "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Error.js",
- "linenr": 81,
- "html_filename": "Error.html",
- "href": "Error.html#Ext-Error-property-ignore",
- "shortDoc": "Static flag that can be used to globally disable error reporting to the browser if set to true\n(defaults to false). N..."
- },
- {
- "tagname": "property",
- "name": "notify",
- "member": "Ext.Error",
- "type": "Object",
- "doc": "Static flag that can be used to globally control error notification to the user. Unlike\nEx.Error.ignore, this does not effect exceptions. They are still thrown. This value can be\nset to false to disable the alert notification (default is true for IE6 and IE7).
\n\nOnly the first error will generate an alert. Internally this flag is set to false when the\nfirst error occurs prior to displaying the alert.
\n\nThis flag is not used in a release build.
\n\nExt.Error.notify = false;\n
\n",
- "private": false,
- "static": true,
- "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Error.js",
- "linenr": 97,
- "html_filename": "Error.html",
- "href": "Error.html#Ext-Error-property-notify",
- "shortDoc": "Static flag that can be used to globally control error notification to the user. Unlike\nEx.Error.ignore, this does no..."
- }
- ],
- "event": [
-
- ],
- "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/lang/Error.js",
- "linenr": 1,
- "html_filename": "Error.html",
- "href": "Error.html#Ext-Error",
- "cssVar": [
-
- ],
- "cssMixin": [
-
- ],
- "component": false,
- "superclasses": [
-
- ],
- "subclasses": [
-
- ],
- "mixedInto": [
-
- ],
- "allMixins": [
-
- ]
-});
\ No newline at end of file
+Ext.data.JsonP.Ext_Error({"tagname":"class","html":"Hierarchy
ErrorExt.ErrorFiles
A wrapper class for the native JavaScript Error object that adds a few useful capabilities for handling\nerrors in an Ext application. When you use Ext.Error to raise an error from within any class that\nuses the Ext 4 class system, the Error class can automatically add the source class and method from which\nthe error was raised. It also includes logic to automatically log the eroor to the console, if available,\nwith additional metadata about the error. In all cases, the error will always be thrown at the end so that\nexecution will halt.
\n\nExt.Error also offers a global error handling method that can be overridden in order to\nhandle application-wide errors in a single spot. You can optionally ignore errors altogether,\nalthough in a real application it's usually a better idea to override the handling function and perform\nlogging or some other method of reporting the errors in a way that is meaningful to the application.
\n\nAt its simplest you can simply raise an error as a simple string from within any code:
\n\nExample usage:
\n\nExt.Error.raise('Something bad happened!');\n
\n\nIf raised from plain JavaScript code, the error will be logged to the console (if available) and the message\ndisplayed. In most cases however you'll be raising errors from within a class, and it may often be useful to add\nadditional metadata about the error being raised. The raise method can also take a config object.\nIn this form the msg
attribute becomes the error description, and any other data added to the config gets\nadded to the error object and, if the console is available, logged to the console for inspection.
Example usage:
\n\nExt.define('Ext.Foo', {\n doSomething: function(option){\n if (someCondition === false) {\n Ext.Error.raise({\n msg: 'You cannot do that!',\n option: option, // whatever was passed into the method\n 'error code': 100 // other arbitrary info\n });\n }\n }\n});\n
\n\nIf a console is available (that supports the console.dir
function) you'll see console output like:
An error was raised with the following data:\noption: Object { foo: \"bar\"}\n foo: \"bar\"\nerror code: 100\nmsg: \"You cannot do that!\"\nsourceClass: \"Ext.Foo\"\nsourceMethod: \"doSomething\"\n\nuncaught exception: You cannot do that!\n
\n\nAs you can see, the error will report exactly where it was raised and will include as much information as the\nraising code can usefully provide.
\n\nIf you want to handle all application errors globally you can simply override the static handle method\nand provide whatever handling logic you need. If the method returns true then the error is considered handled\nand will not be thrown to the browser. If anything but true is returned then the error will be thrown normally.
\n\nExample usage:
\n\nExt.Error.handle = function(err) {\n if (err.someProperty == 'NotReallyAnError') {\n // maybe log something to the application here if applicable\n return true;\n }\n // any non-true return value (including none) will cause the error to be thrown\n}\n
\nStatic flag that can be used to globally disable error reporting to the browser if set to true\n(defaults to false). Note that if you ignore Ext errors it's likely that some other code may fail\nand throw a native JavaScript error thereafter, so use with caution. In most cases it will probably\nbe preferable to supply a custom error handling function instead.
\n\nExample usage:
\n\nExt.Error.ignore = true;\n
\nStatic flag that can be used to globally control error notification to the user. Unlike\nEx.Error.ignore, this does not effect exceptions. They are still thrown. This value can be\nset to false to disable the alert notification (default is true for IE6 and IE7).
\n\nOnly the first error will generate an alert. Internally this flag is set to false when the\nfirst error occurs prior to displaying the alert.
\n\nThis flag is not used in a release build.
\n\nExample usage:
\n\nExt.Error.notify = false;\n
\nCreates new Error object.
\nThe error message string, or an object containing the\nattribute \"msg\" that will be used as the error message. Any other data included in\nthe object will be applied to the error instance and logged to the browser console, if available.
\nProvides a custom string representation of the error object. This is an override of the base JavaScript\nObject.toString
method, which is useful so that when logged to the browser console, an error object will\nbe displayed with a useful message instead of [object Object]
, the default toString
result.
The default implementation will include the error message along with the raising class and method, if available,\nbut this can be overridden with a custom implementation either at the prototype level (for all errors) or on\na particular error instance, if you want to provide a custom description that will show up in the console.
\nThe error message. If raised from within the Ext 4 class system, the error message will also\ninclude the raising class and method names, if available.
\nGlobally handle any Ext errors that may be raised, optionally providing custom logic to\nhandle different errors individually. Return true from the function to bypass throwing the\nerror to the browser, otherwise the error will be thrown and execution will halt.
\n\nExample usage:
\n\nExt.Error.handle = function(err) {\n if (err.someProperty == 'NotReallyAnError') {\n // maybe log something to the application here if applicable\n return true;\n }\n // any non-true return value (including none) will cause the error to be thrown\n}\n
\nRaise an error that can include additional data and supports automatic console logging if available.\nYou can pass a string error message or an object with the msg
attribute which will be used as the\nerror message. The object can contain any other name-value attributes (or objects) to be logged\nalong with the error.
Note that after displaying the error message a JavaScript error will ultimately be thrown so that\nexecution will halt.
\n\nExample usage:
\n\nExt.Error.raise('A simple string error message');\n\n// or...\n\nExt.define('Ext.Foo', {\n doSomething: function(option){\n if (someCondition === false) {\n Ext.Error.raise({\n msg: 'You cannot do that!',\n option: option, // whatever was passed into the method\n 'error code': 100 // other arbitrary info\n });\n }\n }\n});\n
\n