Skip to content

Commit

Permalink
Improve decoding errors from finch-circe
Browse files Browse the repository at this point in the history
  • Loading branch information
clhodapp committed Sep 22, 2016
1 parent c3eaf49 commit 22872c6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion circe/src/main/scala/io/finch/circe/Decoders.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.finch.circe

import cats.syntax.show._
import com.twitter.util.{Return, Throw, Try}
import io.circe.Decoder
import io.circe.jawn.decode
Expand All @@ -12,7 +13,7 @@ trait Decoders {
*/
implicit def decodeCirce[A](implicit d: Decoder[A]): Decode[A] = Decode.instance(s =>
decode[A](s).fold[Try[A]](
error => Throw[A](Error(error.getMessage)),
error => Throw[A](Error(error.show)),
value => Return(value)
)
)
Expand Down

0 comments on commit 22872c6

Please sign in to comment.