Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: ui error handling should be specific to general#14346

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 6 commits intomainfromstevenmasley/ui_error_display
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletionssite/src/api/errors.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -115,18 +115,21 @@ export const getErrorDetail = (error: unknown): string | undefined => {
return error.detail;
}

if (error instanceof Error) {
return "Please check the developer console for more details.";
}

if (isApiError(error)) {
// APIErrors that are empty still benefit from checking the developer
// console if no detail is provided. So only use the detail field if
// it is not empty.
if (isApiError(error) && error.response.data.detail) {
return error.response.data.detail;
}

if (isApiErrorResponse(error)) {
if (isApiErrorResponse(error) && error.detail) {
return error.detail;
}

if (error instanceof Error) {
return "Please check the developer console for more details.";
}

return undefined;
};

Expand Down
9 changes: 9 additions & 0 deletionssite/src/components/Alert/ErrorAlert.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,6 +34,15 @@ export const WithOnlyMessage: Story = {
},
};

export const APIErrorWithDetail: Story = {
args: {
error: mockApiError({
message: "Magic dust is missing",
detail: "without magic dust, the requested operation will never work",
}),
},
};

export const WithDismiss: Story = {
args: {
dismissible: true,
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp