Here is the tips for the way to switch error types using error object types.
Errors Type
- EvalError: using eval wrongly
- RangeError: number or array range violation
- ReferenceError: wring reference used
- SyntaxError: worng syntax in your code
- TypeError: varialble used with different type
- URIError: encodeURI, decodeURI missused
Example
try{
//some code here
}catch(e){
if( e instanceof TypeError){
//do somethign for error
}
}
No comments:
Post a Comment