Skip to content

Commit

Permalink
[fix] type check exception handling on form action (#4532)
Browse files Browse the repository at this point in the history
* type check exception handling on form action

* Create fuzzy-news-raise.md

Co-authored-by: Rich Harris <[email protected]>
  • Loading branch information
avarun42 and Rich-Harris authored Apr 14, 2022
1 parent e82b3d8 commit 598c362
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-news-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-svelte": patch
---

type check exception handling on form action
4 changes: 2 additions & 2 deletions packages/create-svelte/templates/default/src/lib/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export function enhance(
} else {
console.error(await response.text());
}
} catch (e: any) {
if (error) {
} catch (e: unknown) {
if (error && e instanceof Error) {
error({ data, form, error: e, response: null });
} else {
throw e;
Expand Down

0 comments on commit 598c362

Please sign in to comment.