Skip to content

Commit

Permalink
将 jest 换成 mocha
Browse files Browse the repository at this point in the history
  • Loading branch information
FullStackPlayer committed Sep 26, 2022
1 parent f87fca8 commit 267bd64
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ NiceError.execPath = Deno.cwd()

~~~js
// a normal js Error
let err = new Error('This is a normal error')
const err = new Error('This is a normal error')

// a NiceError which takes err as it's inner error
let ne1 = new NiceError('A normal error was caught!',{
const ne1 = new NiceError('A normal error was caught!',{
name: 'NiceError',
cause: err,
info: {
Expand All @@ -70,7 +70,7 @@ let ne1 = new NiceError('A normal error was caught!',{
})

// another NiceError which takes ne1 as it's inner error
let ne2 = new NiceError('An inner NiceError was caught!',{
const ne2 = new NiceError('An inner NiceError was caught!',{
name: 'AppError',
cause: ne1,
info: {
Expand Down Expand Up @@ -139,14 +139,14 @@ output:
#### Handling unexpected thown object as inner error

~~~js
let err = { foo: 'bar'}
const err = { foo: 'bar'}
try {
// just throw an object
throw err
}
catch(err) {
// a NiceError which takes the thrown object as inner err
let ne1 = new NiceError('An object was thrown',{
const ne1 = new NiceError('An object was thrown',{
name: 'NiceError',
cause: err
})
Expand Down Expand Up @@ -207,6 +207,8 @@ catch(ex) {

### Class NiceError

- Static Property
- execPath - String - script base path for replacing it from stack info
- Property
- name - String - error name
- message - String - error message
Expand Down

0 comments on commit 267bd64

Please sign in to comment.