-
Notifications
You must be signed in to change notification settings - Fork 662
fix: improve error handling and documentation in locale regex and fetch response #1356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |
| "new": "changeset", | ||
| "new:empty": "changeset --empty", | ||
| "format": "prettier . --write", | ||
| "format:check": "prettier . --check" | ||
| "format:check": "prettier . --check", | ||
| }, | ||
| "devDependencies": { | ||
| "@babel/generator": "^7.27.1", | ||
|
|
@@ -31,4 +31,4 @@ | |
| "node-machine-id": "^1.1.12" | ||
| }, | ||
| "packageManager": "[email protected]" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -133,16 +133,35 @@ export class LingoDotDevEngine { | |||||||||||||
| signal, | ||||||||||||||
| }); | ||||||||||||||
|
|
||||||||||||||
| // if (!res.ok) { | ||||||||||||||
| // if (res.status >= 500 && res.status < 600) { | ||||||||||||||
| // const errorText = await res.text(); | ||||||||||||||
| // throw new Error( | ||||||||||||||
| // `Server error (${res.status}): ${res.statusText}. ${errorText}. This may be due to temporary service issues.`, | ||||||||||||||
| // ); | ||||||||||||||
| // } else if (res.status === 400) { | ||||||||||||||
| // throw new Error(`Invalid request: ${res.statusText}`); | ||||||||||||||
| // } else { | ||||||||||||||
| // const errorText = await res.text(); | ||||||||||||||
| // throw new Error(errorText); | ||||||||||||||
| // } | ||||||||||||||
| // } | ||||||||||||||
|
|
||||||||||||||
| /* The above TypeScript code is handling errors from a fetch request. It checks if the response | ||||||||||||||
| `res` is not ok (i.e., the status is not in the 200-299 range). If the status code is in the | ||||||||||||||
| 500-599 range, it throws an error indicating a server error along with the status code, status | ||||||||||||||
| text, and the error text received from the response. If the status code is 400, it throws an | ||||||||||||||
| error indicating an invalid request with the status text. For any other status codes, it throws | ||||||||||||||
| an error with the error text received from the response. */ | ||||||||||||||
Nitin-kumar-yadav marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+150
to
+155
|
||||||||||||||
| /* The above TypeScript code is handling errors from a fetch request. It checks if the response | |
| `res` is not ok (i.e., the status is not in the 200-299 range). If the status code is in the | |
| 500-599 range, it throws an error indicating a server error along with the status code, status | |
| text, and the error text received from the response. If the status code is 400, it throws an | |
| error indicating an invalid request with the status text. For any other status codes, it throws | |
| an error with the error text received from the response. */ |
Uh oh!
There was an error while loading. Please reload this page.