-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- So far basic use cases (including nested try statements) are working. Still needs `finally` and additional tests before #9 can be closed. - Fixes inheritance on the native Error constructors.
- Loading branch information
1 parent
5d67134
commit 31d4c79
Showing
9 changed files
with
170 additions
and
19 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
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,39 @@ | ||
// test_try.js | ||
// ----------- | ||
|
||
// A few basic tests | ||
|
||
try { | ||
console.assert(false); | ||
} catch(e) { | ||
} | ||
|
||
try { | ||
throw new Error(); | ||
} catch(e) { | ||
} | ||
|
||
try { | ||
throw new EvalError('the message'); | ||
} catch (e) { | ||
console.assert(e.message === 'the message'); | ||
console.assert(e.name === 'EvalError'); | ||
console.assert(e instanceof EvalError); | ||
} | ||
|
||
try { | ||
throw new EvalError('another message'); | ||
} catch (someSpecialName) { | ||
console.assert(someSpecialName.message === 'another message'); | ||
} | ||
|
||
try { | ||
try { | ||
throw new Error('from inner try'); | ||
} catch (e) { | ||
console.assert(e.message === 'from inner try'); | ||
throw new Error('from inner catch'); | ||
} | ||
} catch (e) { | ||
console.assert(e.message === 'from inner catch'); | ||
} |