Skip to content

Commit a46048e

Browse files
eh-steveAnonymous
authored and
Anonymous
committed
Bugfix 404 response from getFlowError
1 parent 28477dd commit a46048e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

examples/nextjs-spa/src/pages/error.tsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,16 @@ const Error: NextPageWithLayout = () => {
5151
.then(({ data }) => {
5252
setError(JSON.stringify(data, null, 2))
5353
})
54-
.catch(handleError)
54+
.catch((error: AxiosError) => {
55+
switch (error.response?.status) {
56+
case 404: {
57+
// The kratos handler for /self-service/errors?id=some_error_id currently only handles id=stub:500, and will 404 for everything else
58+
// See https://github.com/ory/kratos/blob/4fb28b363622bb21ce12d9f89d2ceb4649aa0cba/selfservice/errorx/handler.go#L106
59+
return;
60+
}
61+
}
62+
handleError(error).then();
63+
});
5564
}
5665
}, [err, id, router.isReady, handleError])
5766

0 commit comments

Comments
 (0)