How do I turn all rejections into custom json in spray?-Collection of common programming errors

When spray (spray.io) produces a rejection, it responds with a string body. Since all my API clients will assume that my API only returns json, I’d like globally make every rejection a valid json object that conforms to our error object format. How can I make this happen?

The error object format looks like this

{
    'details' : 'Something happened in the app. boooo!',
    'errorType' : 'Unknown'
}

The errorType is my internal enum-style list of values like UserNotFound and NeedPaidAccount