| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7e58da6 commit 73ad3ca
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,17 @@ | |||
| 1 | + "use strict"; | ||
| 2 | + export function isSwcError(error) { | ||
| 3 | + return error.code !== void 0; | ||
| 4 | + } | ||
| 5 | + export function wrapAndReThrowSwcError(error) { | ||
| 6 | + switch (error.code) { | ||
| 7 | + case "UnsupportedSyntax": { | ||
| 8 | + const unsupportedSyntaxError = new Error(error.message); | ||
| 9 | + unsupportedSyntaxError.name = "UnsupportedSyntaxError"; | ||
| 10 | + throw unsupportedSyntaxError; | ||
| 11 | + } | ||
| 12 | + case "InvalidSyntax": | ||
| 13 | + throw new SyntaxError(error.message); | ||
| 14 | + default: | ||
| 15 | + throw new Error(error.message); | ||
| 16 | + } | ||
| 17 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments