{"action":"created","issue":{"url":"https://api.github.com/repos/ideaq/hapi-auth-jwt2/issues/39","labels_url":"https://api.github.com/repos/ideaq/hapi-auth-jwt2/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/ideaq/hapi-auth-jwt2/issues/39/comments","events_url":"https://api.github.com/repos/ideaq/hapi-auth-jwt2/issues/39/events","html_url":"https://github.com/ideaq/hapi-auth-jwt2/issues/39","id":72535221,"number":39,"title":"Do not return stringified jsonwebtoken error in Boom","user":{"login":"eventhough","id":443149,"avatar_url":"https://avatars.githubusercontent.com/u/443149?v=3","gravatar_id":"","url":"https://api.github.com/users/eventhough","html_url":"https://github.com/eventhough","followers_url":"https://api.github.com/users/eventhough/followers","following_url":"https://api.github.com/users/eventhough/following{/other_user}","gists_url":"https://api.github.com/users/eventhough/gists{/gist_id}","starred_url":"https://api.github.com/users/eventhough/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eventhough/subscriptions","organizations_url":"https://api.github.com/users/eventhough/orgs","repos_url":"https://api.github.com/users/eventhough/repos","events_url":"https://api.github.com/users/eventhough/events{/privacy}","received_events_url":"https://api.github.com/users/eventhough/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ideaq/hapi-auth-jwt2/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/ideaq/hapi-auth-jwt2/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/ideaq/hapi-auth-jwt2/labels/help%20wanted","name":"help wanted","color":"159818"},{"url":"https://api.github.com/repos/ideaq/hapi-auth-jwt2/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-01T22:09:16Z","updated_at":"2015-05-06T05:59:13Z","closed_at":null,"body":"Most of the errors I send back via Boom contain a simple message string, not a stringified JSON object. This is the only error I have to process on the front-end where I need to parse the error body to get the message string back.\r\n\r\nThis is the line I am talking about: [https://github.com/ideaq/hapi-auth-jwt2/blob/master/lib/index.js#L41](https://github.com/ideaq/hapi-auth-jwt2/blob/master/lib/index.js#L41)\r\n\r\nI think adding a stringified JSON object only makes error handling more complicated. There are really only two major types of errors that jsonwebtoken returns, either `TokenExpiredError` or `JsonWebTokenError`. My suggestion would be to just retur a simple string for either error:\r\n\r\n- \"Token expired\"\r\n\r\n- \"Invalid token\"\r\n\r\nWe can decide on the front-end to use a more friendly error message if we want. My argument is that it seems like this is more in line with how Boom was designed to be used. The structure of a Boom error is so simple:\r\n\r\n```\r\n{\r\n    \"statusCode\": 403,\r\n    \"error\": \"Forbidden\",\r\n    \"message\": \"try again some time\"\r\n}\r\n```\r\n\r\nThoughts?"},"comment":{"url":"https://api.github.com/repos/ideaq/hapi-auth-jwt2/issues/comments/99333410","html_url":"https://github.com/ideaq/hapi-auth-jwt2/issues/39#issuecomment-99333410","issue_url":"https://api.github.com/repos/ideaq/hapi-auth-jwt2/issues/39","id":99333410,"user":{"login":"eventhough","id":443149,"avatar_url":"https://avatars.githubusercontent.com/u/443149?v=3","gravatar_id":"","url":"https://api.github.com/users/eventhough","html_url":"https://github.com/eventhough","followers_url":"https://api.github.com/users/eventhough/followers","following_url":"https://api.github.com/users/eventhough/following{/other_user}","gists_url":"https://api.github.com/users/eventhough/gists{/gist_id}","starred_url":"https://api.github.com/users/eventhough/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eventhough/subscriptions","organizations_url":"https://api.github.com/users/eventhough/orgs","repos_url":"https://api.github.com/users/eventhough/repos","events_url":"https://api.github.com/users/eventhough/events{/privacy}","received_events_url":"https://api.github.com/users/eventhough/received_events","type":"User","site_admin":false},"created_at":"2015-05-06T05:59:13Z","updated_at":"2015-05-06T05:59:13Z","body":"Working on PR but having trouble passing the real_world_example tests because it looks like I need to set up redis?"}}