spray / spray-json

A lightweight, clean and simple JSON implementation in Scala
Apache License 2.0
974 stars 190 forks source link

Custom error message while Deserialization Exception #192

Open hardvain opened 8 years ago

hardvain commented 8 years ago

Hi, I am using spray-json v1.3.1. In this, I have a complex AST and I am trying to convert a json to this AST using spray json. I have defined RootJsonFormats for the objects in the AST. In case of a data type mismatch or some error in json, spray-json throws an error message like Expect JsBoolean which I dont want to expose outside. Is there a way to customize this message. Mine is a spray app. Also All our APIs return a json in case of error in a specific structure. I would also like to send DeserilizationExceptions as json. How to do this?