-
-
Notifications
You must be signed in to change notification settings - Fork 110
Added support for: reject status code
and message
; context.statusCode
.
#397
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
Conversation
…ge`: * `message` is now setting HTTP status code, 500 by default; * `message` appends to body, 'Server Error' by default.
@mrauhu It might be better to add machine readable strings. A bit like how the Meteor guide describes the error field: https://guide.meteor.com/methods.html#throwing-errors. This way we can apply translations to them and it follows a similar structure to how Apollo's resolvers work: https://www.apollographql.com/docs/apollo-server/data/errors/ |
Purpose of this changes is make a human readable Server-Side Rendered (SSR) 404 error page with a machine readable @chris-visser please, read carefully: Right now, the no matched routes example code from vue-meteor/packages/vue-ssr/README.md Lines 85 to 88 in 078e632
This pull-request fix the bug and make code cross-platform between the Vue SSR guide approach and Vue+Meteor SSR. Basically, you can copy code from your Vue.js or Nuxt.js application to Vue+Meteor and it's works. As example, you may return Please, see the code from the Vue SSR guide:
// wait until router has resolved possible async components and hooks
router.onReady(() => {
const matchedComponents = router.getMatchedComponents()
// no matched routes, reject with 404
if (!matchedComponents.length) {
return reject({ code: 404 })
}
// the Promise should resolve to the app instance so it can be rendered
resolve(app)
}, reject)
It's not about Meteor or Apollo errors. Optional the vue-meteor/packages/vue-ssr/server/index.js Lines 67 to 69 in 2ddce13
Thank you for attention, |
Oh lol. Turned out I'd misread your example. You are showing it indeed as part of how devs could use it. Actually really nice this! 🙂 |
Greetings, Guillaume @Akryum.
In this pull request I added support for:
code
set status code andmessage
appends to body:context.statusCode
and example of usage with wildcard*
path for creating custom 404 error.Best wishes,
Sergey.
P.S. This pull request is copy of #390, but from different branch (not
master
).