diff --git a/webapp/nuxt.config.js b/webapp/nuxt.config.js index 7ea1038a9..a0bc3891e 100644 --- a/webapp/nuxt.config.js +++ b/webapp/nuxt.config.js @@ -165,14 +165,7 @@ module.exports = { tokenExpires: 3, // optional, default: 7 (days) // includeNodeModules: true, // optional, default: false (this includes graphql-tag for node_modules folder) // optional - errorHandler(error) { - /* eslint-disable-next-line no-console */ - console.log( - '%cError', - 'background: red; color: white; padding: 2px 4px; border-radius: 3px; font-weight: bold;', - error.message, - ) - }, + errorHandler: '~/plugins/apollo-error-handler.js', // Watch loading state for all queries // See 'Smart Query > options > watchLoading' for detail diff --git a/webapp/plugins/apollo-error-handler.js b/webapp/plugins/apollo-error-handler.js new file mode 100644 index 000000000..93a9c957c --- /dev/null +++ b/webapp/plugins/apollo-error-handler.js @@ -0,0 +1,9 @@ +export default (error, context) => { + /* eslint-disable-next-line no-console */ + console.log( + '%cError', + 'background: red; color: white; padding: 2px 4px; border-radius: 3px; font-weight: bold;', + error.message, + ) + context.error({ statusCode: 304, message: 'Server error' }) +}