Open amnaredo opened 3 years ago
Hi Peter!
This sounds alike a reasonable either (maybe called readEither
?).
One issue with uPickle is I do not think it is sufficiently rigorous with what exceptions are thrown, when and why. Trying to stuff it into an Either
or Try
would be a good time to start adding tests and documentation for all the error cases, so we know exactly how uPickle behaves in each case
Original Author: lihaoyi
Yeah, readEither
sounds really good, I'm not opinionated. In Circe decode
returns the same.
Is that something you'd do soon or do you prefer me to give it a try?
Would it suffice to check for Exception
and extract the massage where ever it was instantiated?
Original Author: peter-empen
I won’t have time to take a crack at it any time soon, so go ahead
On Mon, 1 Jun 2020 at 7:56 PM, peter-empen notifications@github.com wrote:
Yeah, readEither sounds really good, I'm not opinionated. In Circe decode returns the same.
Is that something you'd do soon or do you prefer me to give it a try?
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/lihaoyi/upickle/issues/312#issuecomment-636814679, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHEB7GXMLETGIT5XC6DU6LRUOJPTANCNFSM4NPW6Q3A .
Original Author: lihaoyi
OK.
To finalize the signature, is it correct to assume that read
always fails fast? Otherwise we better use a type that allows to return any number of failures.
And, if we just want to return a single failure, does it make sense to have a ParseFailure
class instead of just using String
?
Original Author: peter-empen
yes currently read always fails fast with an exception Original Author: lihaoyi
upickle.jvm("2.11.12").compile()
but it does not work.@lihaoyi Waiting for your kind review of https://github.com/lihaoyi/upickle/pull/317... Original Author: peter-empen
Hi Li,
what is your attitude towards an additional read method that will never throw an exception? I mean a signature like
def maybeRead[T: Reader](s: ujson.Readable): Either[String, T]
whereString
would be the message of the exception you are throwing.Although this is easy to achieve on top of the current read, I still wonder whether it was worth to supply.
ID: 312 Original Author: peter-empen