Correct way to return error in custom service through GraphQL

Stumbled upon this entry and here’s my solution after some research. To return a custom message through graphql, you can throw as below as graphql displays that message instead

if (someLogicIsWrong) {
  throw new Error('your message here')
}