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

Feat: Improved error handling and response status availability#2303

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
jhildenbiddle merged 8 commits intodevelopfrom2294-route-response
Nov 17, 2023

Conversation

@jhildenbiddle
Copy link
Member

@jhildenbiddlejhildenbiddle commentedNov 14, 2023
edited
Loading

Summary

  • Add response status to internal route object
  • Expose response status to plugin hooks to allow for custom error handling.
  • Update default error page content with error status and status text (e.g. "401 - Not Authorized", "500 - Internal Server Error", etc.) instead of displaying "404 - Not Found" forall errors.
  • Fix issue where initial site render was incomplete when content fetch failed (e.g., no sidebar, plugins halted, etc.)
  • Fix issue where empty markdown pages/routes were handled as 404 errors.
  • Add tests to verify default error handling
  • Add tests to verifynotFoundPage error handling
  • Add tests to verify response data availability via plugins

See#2294 for details.

Screenshots

Custom error handling via plugins (example)

CleanShot 2023-11-16 at 21 57 43@2x

window.$docsify={// ...plugins:[function(hook,vm){hook.beforeEach(html=>{const{ file, response}=vm.route;const{ ok, status, statusText}=response;if(ok===false){return[`# Oops!`,`A **${status} -${statusText}** error occurred while requesting **${vm.route.file}**`,].join('\n\n');}});},],}

Default error content updates (500 error)

Before: Displays inaccurate error information (shows 404 but should be 500)

CleanShot 2023-11-16 at 19 03 25@2x

After: Displays accurate error information

CleanShot 2023-11-16 at 19 03 32@2x


Initial render with content load error

Before: No sidebar, plugins halted

CleanShot 2023-11-16 at 18 22 49@2x

After: Sidebar rendered, plugins complete

CleanShot 2023-11-16 at 18 22 56@2x


Rendering empty files/routes

Before: Empty files incorrectly treated as 404 errors

CleanShot 2023-11-16 at 19 10 49@2x

After: Empty files rendered properly

CleanShot 2023-11-16 at 19 11 01@2x


Related issue, if any:

#2294

What kind of change does this PR introduce?

Feature

For any code change,

  • Related tests have been added or updated, if needed

Does this PR introduce a breaking change?

No

Tested in the following browsers:

  • Chrome
  • Firefox
  • Safari
  • Edge

@vercel
Copy link

vercelbot commentedNov 14, 2023
edited
Loading

The latest updates on your projects. Learn more aboutVercel for Git ↗︎

NameStatusPreviewCommentsUpdated (UTC)
docsify-preview✅ Ready (Inspect)Visit Preview💬Add feedbackNov 17, 2023 1:15am

@jhildenbiddlejhildenbiddle marked this pull request as ready for reviewNovember 14, 2023 20:42
sy-records
sy-records previously approved these changesNov 15, 2023
Copy link
Member

@sy-recordssy-records left a comment

Choose a reason for hiding this comment

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

LGTM.

jhildenbiddle reacted with thumbs up emoji
@sy-recordssy-records requested a review froma teamNovember 15, 2023 00:11
@jhildenbiddlejhildenbiddle linked an issueNov 16, 2023 that may beclosed by this pull request
@jhildenbiddlejhildenbiddle changed the titleFeat: Expose response status internally and to pluginsFeat: Improved error handling and response status availabilityNov 17, 2023
Copy link
Member

@Koooooo-7Koooooo-7 left a comment
edited
Loading

Choose a reason for hiding this comment

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

LGTM, that really a customize handler hook enhancement.

@jhildenbiddlejhildenbiddle merged commitdac8e59 intodevelopNov 17, 2023
@jhildenbiddlejhildenbiddle deleted the 2294-route-response branchNovember 17, 2023 13:27
@sy-recordssy-records mentioned this pull requestMay 5, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@sy-recordssy-recordssy-records approved these changes

@Koooooo-7Koooooo-7Koooooo-7 approved these changes

@trusktrtrusktrAwaiting requested review from trusktr

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Feature: Add response status toroute object and plugins

4 participants

@jhildenbiddle@Koooooo-7@sy-records

[8]ページ先頭

©2009-2025 Movatter.jp