Skip to content

Commit

Permalink
📝 update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
necojackarc committed Oct 7, 2018
1 parent bfbdc0a commit 0661c06
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
16 changes: 16 additions & 0 deletions .gitmessage
@@ -0,0 +1,16 @@


; ==== Format of the commit message ====
; <type>(<scope>) <subject>
;
; <body>

; ==== Emoji list for the type ====
; :tada: adding new features
; :bug: fixing broken code (bugs we're proud to solve)
; :flushed: embarrassing bug fixes
; :white_check_mark: grunt work (non-feature and non-bugfix tasks)
; :memo: adding or maintaining documentation
; :hammer_and_wrench: writing or fixing tests
; :cherry_blossom: refactoring code or improving code-style
; :art: improving the theming of the app
14 changes: 7 additions & 7 deletions README.md
Expand Up @@ -47,8 +47,6 @@ To define custom errors in Vanilla JS, you need to set names and stack traces ma
class MyError extends ExtensibleCustomError {}
```

N.B. With an uglifier, class names might get obsecure. See [this issue comment](https://github.com/bjyoungblood/es6-error/issues/31#issuecomment-301128220).

### Wrap errors without losing any data

Built-in errors only take a message, so they can't wrap any errors, which means stack traces so far will be lost.
Expand Down Expand Up @@ -108,12 +106,14 @@ class MyErrorWithCustomProperty extends ExtensibleCustomError {
}
```

N.B. With an uglifier, class names might get obsecure. See [this issue comment](https://github.com/bjyoungblood/es6-error/issues/31#issuecomment-301128220).

### Instantiate custom errors

You can instantiate your custom errors in the same way as built-in errors.

```js
// Do it as usual!
// Throw it as usual!
throw new MyError('Steel is my Body and Fire is my Blood');
```

Expand Down Expand Up @@ -162,11 +162,11 @@ function main() {
try {
wrapErrorWithMyError();
} catch (error) {
console.log(error)
console.log(error);
}
}

main()
main();
```

you'll get:
Expand Down Expand Up @@ -212,11 +212,11 @@ function main() {
try {
wrapErrorWithMyError();
} catch (error) {
console.log(error)
console.log(error);
}
}

main()
main();
```

you'll get:
Expand Down

0 comments on commit 0661c06

Please sign in to comment.