Skip to content

Commit

Permalink
fix: Ease timeout condition to also use 503 response
Browse files Browse the repository at this point in the history
  • Loading branch information
neet committed Dec 6, 2024
1 parent c2df98e commit 689e418
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/[locale]/_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ export async function translate(

return result;
} catch (error) {
if (error instanceof DOMException && error.name === "TimeoutError") {
if (
(error instanceof Response && error.status === 503) ||
(error instanceof DOMException && error.name === "TimeoutError")
) {
return {
type: "error",
message:
Expand Down

0 comments on commit 689e418

Please sign in to comment.