Skip to content

Commit fb3230e

Browse files
committed
refactor(api): improve error message for failed response parsing
1 parent 4e2ecbe commit fb3230e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/services/api.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ export class APIService {
3939
}
4040

4141
const data = await response.json().catch(() => {
42-
throw new SquareCloudAPIError("CANNOT_PARSE_RESPONSE", "Try again later");
42+
throw new SquareCloudAPIError(
43+
"CANNOT_PARSE_RESPONSE",
44+
`Failed with status ${response.status}`,
45+
);
4346
});
4447

4548
if (!data || data.status === "error" || !response.ok) {

0 commit comments

Comments
 (0)