-
Notifications
You must be signed in to change notification settings - Fork 644
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle errors thrown in await catch attrs
- Loading branch information
1 parent
59dd026
commit 4286236
Showing
4 changed files
with
30 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"marko": patch | ||
--- | ||
|
||
Handle errors thrown in await catch attribute |
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
10 changes: 10 additions & 0 deletions
10
packages/marko/test/render/fixtures/await-error-rethrow-catch/template.marko
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,10 @@ | ||
--- | ||
BEFORE | ||
<await(Promise.reject(new Error("Something went wrong!")))> | ||
<@then|testData|>Success!</@then> | ||
<@catch|err|> | ||
$ throw err | ||
</@catch> | ||
</await> | ||
AFTER | ||
--- |
10 changes: 10 additions & 0 deletions
10
packages/marko/test/render/fixtures/await-error-rethrow-catch/test.js
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,10 @@ | ||
var expect = require("chai").expect; | ||
|
||
exports.templateData = {}; | ||
|
||
exports.skip_vdom = "VDOM does not support async components"; | ||
|
||
exports.checkError = function (e) { | ||
var message = e.toString(); | ||
expect(message).to.contain("Something went wrong"); | ||
}; |