Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Redirect to 404 Page When Note is Not Found #277

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
16 changes: 10 additions & 6 deletions src/application/services/useNote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,16 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt
/**
* @todo try-catch domain errors
*/
const response = await noteService.getNoteById(id);

note.value = response.note;
canEdit.value = response.accessRights.canEdit;
noteTools.value = response.tools;
parentNote.value = response.parentNote;
try {
const response = await noteService.getNoteById(id);

note.value = response.note;
canEdit.value = response.accessRights.canEdit;
noteTools.value = response.tools;
parentNote.value = response.parentNote;
} catch (error) {
void router.push('/error');
Copy link
Member

@neSpecc neSpecc Nov 16, 2024

Choose a reason for hiding this comment

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

I'd suggest to separate 4xx errors and other errors. If 4xx error happen, show 404 error page. In case of other errors, show 500 "Unexpected error" page

Copy link
Author

Choose a reason for hiding this comment

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

request you to review new changes

}
}

/**
Expand Down
Loading