SpinGo / op-rabbit

The Opinionated RabbitMQ Library for Scala and Akka
Other
232 stars 73 forks source link

Error handling in play json unmarshall #55

Closed laverton closed 8 years ago

laverton commented 8 years ago

When conversion from JSON to case class in the PlayJsonSupport unmarshall function fails, the error is not handled very well: java.util.NoSuchElementException: JsError.get Is there any way to handle the error properly, and for example retrieve the contents of the JsError?

timcharper commented 8 years ago

That's awful, @laverton . Must have been a horrible experience finding out what was going on. The offending code is here:

https://github.com/SpinGo/op-rabbit/blob/master/addons/play-json/src/main/scala/com/spingo/op_rabbit/PlayJsonSupport.scala#L55

This should definitely match the JsResult and, if erroneous, unwrap the error and throw it.

timcharper commented 8 years ago

1.2.1 was released with a fix.