Skip to content

Commit eaeefc2

Browse files
feat: add error object
1 parent 1535a41 commit eaeefc2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
INFO: Error Object
3+
The Error object in javascript is used to represent rumtime errors. It helps identify what went wrong and where it happened.
4+
*/
5+
6+
// You can create an error manually like this:
7+
let err = new Error("Something went wrong");
8+
throw err; // Throws the err
9+
10+
// Properties of Error
11+
12+
let error = new Error("Something failed");
13+
console.log(error.name); // "Error"
14+
console.log(error.message); // "Something failed"
15+
console.log(error.stack); // Stack trace info

0 commit comments

Comments
 (0)