We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0816f09 commit a8d0f56Copy full SHA for a8d0f56
1 file changed
apps/box/src/services/poolApiService.ts
@@ -54,10 +54,21 @@ export class PoolApiService {
54
}
55
56
if (!response.ok) {
57
- return {
58
- status: 'err',
59
- msg: `HTTP error! status: ${response.status}`,
60
- };
+ // Try to parse the error body — the server returns { status, msg, errors? }
+ try {
+ const errorData: JoinPoolResponse = await response.json();
+ if (errorData.errors?.length) {
61
+ errorData.msg = errorData.errors
62
+ .map((e) => `${e.field}: ${e.message}`)
63
+ .join('; ');
64
+ }
65
+ return errorData;
66
+ } catch {
67
+ return {
68
+ status: 'err',
69
+ msg: `HTTP error! status: ${response.status}`,
70
+ };
71
72
73
74
const data: JoinPoolResponse = await response.json();
0 commit comments