error:
https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Errornuxt's error 強制調用:
this.$nuxt.error({ statusCode: 404, message: "hi" })
nuxt's server error (maybe about ssr):
https://blog.lichter.io/posts/nuxtjs-change-server-error-page/
error handling時機:
https://medium.com/@benrichardson_5275/handling-errors-while-server-side-rendering-your-code-in-nuxt-js-d733ed76239d
public async asyncData (context: any): Promise<any> {
const { params, query, route } = context;
const websiteCode = getWebsiteCode(params.region);
try {
throw new Error("hj");
} catch (e) {
console.log(e.name); // 'MyError'
console.log(e.message); // 'custom message'
context.error(e)
}
// ...
沒有留言:
張貼留言