HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
The Error object provides error information when an error occurs
The Error object provides error information when an error occurs.
In this example we have written "alert" as "adddlert" to deliberately produce an error.
Return the error name and a description of the error:
try {
adddlert("Welcome");
}
catch(err) {
document.getElementById("demo").innerHTML =
err.name + "<br>" + err.message;
}
For a tutorial about JavaScript Errors, read our JavaScript Error Tutorial.
Property | Description |
---|---|
name | Sets or returns an error name |
message | Sets or returns an error message (a string) |
Error Name | Description | Try it |
---|---|---|
EvalError | Deprecated - use SyntaxError instead | |
RangeError | A number "out of range" has occurred | Try it » |
ReferenceError | An illegal reference has occurred | Try it » |
SyntaxError | A syntax error has occurred | Try it » |
TypeError | A type error has occurred | Try it » |
URIError | An error in encodeURI() has occurred | Try it » |
Do not use these properties and methods in public web sites. They will not work in all browsers.
Property | Description |
---|---|
arguments | Deprecated |
caller | Deprecated |
columnNumber | Firefox only |
description | Microsoft only |
displayName | Firefox only |
fileName | Firefox only |
lineNumber | Firefox only |
number | Microsoft only |
stack | Firefox only |
Methods | Description |
evalError() | Deprecated |
internalError() | Firefox only |
toSource() | Non Standard |