-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! GenericErrorConstructor adaptor
- Loading branch information
Showing
11 changed files
with
234 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* eslint-disable max-classes-per-file */ | ||
import { test } from './prepare-test-env-ava.js'; | ||
|
||
// eslint-disable-next-line import/order | ||
import { passStyleOf } from '../src/passStyleOf.js'; | ||
|
||
test('style of extended errors', t => { | ||
const e1 = Error('e1'); | ||
t.throws(() => passStyleOf(e1), { | ||
message: 'Cannot pass non-frozen objects like "[Error: e1]". Use harden()', | ||
}); | ||
harden(e1); | ||
t.is(passStyleOf(e1), 'error'); | ||
|
||
const e2 = harden(Error('e2', { cause: e1 })); | ||
t.is(passStyleOf(e2), 'error'); | ||
|
||
const u3 = harden(URIError('u3', { cause: e1 })); | ||
t.is(passStyleOf(u3), 'error'); | ||
|
||
const a4 = harden(AggregateError([e2, u3], 'a4', { cause: e1 })); | ||
t.is(passStyleOf(a4), 'error'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.