frasertweedale/hs-jose

improve `CompactDecodeError` reporting

frasertweedale opened this issue · 2 comments

Strings suck. Create a dedicated type to represent a compact representation decoding error and change the CompactDecodeError constructor to use it. Cases of JSON (aeson) decoding errors when processing a compact object should throw JSONDecodeError.

robx commented

Just to note that this change causes a rather redundant error formatting when using show:

Instead of

JWSError (CompactDecodeError "expected 3 parts, got 2")

I now see

JWSError (CompactDecodeError CompactDecodeError: Expected 3 parts; got 2)

in PostgREST output. (I'm not sure this is wrong, and should maybe be fixed by not just showing errors, but it does look a bit redundant.)

@robx thanks, it's a bit of a brain-o, I pushed to master a commit improving this but I'm not in a hurry to release it, it will just get picked up in a future release.