Skip to content

Commit

Permalink
chore: improve error notifications in annotations and notebooks
Browse files Browse the repository at this point in the history
I noticed that annotations and notebooks could display the api error
when requests fail - they are not consistent about it.
  • Loading branch information
philjb committed Aug 20, 2024
1 parent f46e47d commit 946ae96
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const AnnotationForm: FC<Props> = (props: Props) => {
}

try {
dispatch(deleteAnnotations(editedAnnotation))
await dispatch(deleteAnnotations(editedAnnotation))
event(`annotations.delete_annotation.success`, {
prefix: props.eventPrefix,
})
Expand Down
5 changes: 3 additions & 2 deletions src/flows/context/flow.list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
} from 'src/shared/copy/notifications'
import {setCloneName} from 'src/utils/naming'
import {CLOUD} from 'src/shared/constants'
import {getErrorMessage} from 'src/utils/api'

export interface FlowListContextType extends FlowList {
add: (flow?: Flow) => Promise<string | void>
Expand Down Expand Up @@ -238,8 +239,8 @@ export const FlowListProvider: FC = ({children}) => {

return flow.id
})
.catch(() => {
dispatch(notify(notebookCreateFail()))
.catch((err) => {
dispatch(notify(notebookCreateFail(getErrorMessage(err))))
})
}

Expand Down
4 changes: 2 additions & 2 deletions src/shared/copy/notifications/categories/notebooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export const panelCopyLinkFail = (): Notification => ({
message: `Failed to copy the panel link`,
})

export const notebookCreateFail = (): Notification => ({
export const notebookCreateFail = (error: string): Notification => ({
...defaultErrorNotification,
message: `Failed to create Notebook, please try again.`,
message: `Failed to create Notebook, please try again: ${error}`,
})

export const notebookUpdateFail = (): Notification => ({
Expand Down

0 comments on commit 946ae96

Please sign in to comment.