Skip to content

Returning the error message detail(when accepting/creating scrimmage) from backend to frontend #914

Merged
nour-massri merged 2 commits intomainfrom
ranked-matches-disabled-message
Jan 15, 2025
Merged

Returning the error message detail(when accepting/creating scrimmage) from backend to frontend #914
nour-massri merged 2 commits intomainfrom
ranked-matches-disabled-message

Conversation

@nour-massri
Copy link
Member

No description provided.

@nour-massri nour-massri changed the title adding expressive frontend message saying ranked matches are disabled Returning the error message detail(when accepting/creating scrimmage) from backend to frontend Jan 15, 2025
@nour-massri nour-massri requested a review from lowtorola January 15, 2025 16:32
@nour-massri
Copy link
Member Author

closes #908

Copy link
Contributor

@lowtorola lowtorola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming youve tested this it looks great to me! see my comment about the refactored function, that would be a great issue to create :shipit:

Comment on lines +379 to +388
} catch (e: unknown) {
const error = e as ResponseError;
// Parse the response text as JSON, detail propety contains the error message
const errorJson = (await error.response.json()) as {
detail?: string;
};
const errorDetail =
errorJson.detail ?? "An unexpected error occurred.";
throw new Error(errorDetail);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! At some point we need to go through and make this a type-ified function which errors in detail for every frontend mutation.

@nour-massri nour-massri merged commit 55deaf8 into main Jan 15, 2025
3 checks passed
@nour-massri nour-massri deleted the ranked-matches-disabled-message branch January 15, 2025 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants