What I’m doing to copy Strapi’s own error reporting approach, is:
// HTTP Error library used by Strapi, allows us to display custom error message in the CMS
const Boom = require('boom')
...
resolver: async (_ , { id }) => {
const book = await strapi.services['books'].findOne({ id })
if (!book) throw Boom.notFound('No book found by that id.')
return book
}
Would be interested to hear the Strapi team’s opinion on this approach.