Update client to PureScript 0.15.2#278
Update client to PureScript 0.15.2#278JordanMartinez merged 9 commits intopurescript:masterfrom JordanMartinez:update-client
Conversation
client/src/Try/API.purs
Outdated
| _ -> | ||
| Left "Tag must be one of: OtherError, CompilerErrors" | ||
| j -> | ||
| Left $ AtKey "tag" $ UnexpectedValue $ encodeJson j |
There was a problem hiding this comment.
Can we preserve the detail in the error message using Tagged from codec-argonaut?
There was a problem hiding this comment.
I'm not sure how to do that. Can you clarify?
There was a problem hiding this comment.
Sorry, I meant Named from Argonaut-codecs 😅 It lets you annotate an error, like:
Named “Message” $ UnexpectedValue …
There was a problem hiding this comment.
Hmm. It’s not really the right one, though, because it’s more for annotating structure. There’s not really a proper error type for this, other than maybe TypeMismatch. But I think it’s useful to show what the allowed constructors are in the error message.
There was a problem hiding this comment.
This is why I don't like JsonDecodeError. You can't provide error messages that have actionable "how to fix it" instructions.
There was a problem hiding this comment.
So, how should I address this issue?
There was a problem hiding this comment.
Yea, I don't love it either. Wish I hadn't added it to argonaut proper.
One option is this:
AtKey "tag" $ TypeMismatch "Expected tag to be one of 'OtherError, CompilerErrors'"but I'm fine leaving it with what you've written here, too. Your call :)
| _ -> | ||
| Left "Tag must be one of: OtherError, CompilerErrors" | ||
| j -> | ||
| Left $ AtKey "tag" $ UnexpectedValue $ encodeJson $ "- Expected a value of `OtherError` or `CompilerErrors` but got '" <> j <> "'" |
There was a problem hiding this comment.
encodeJson FTW! 😄
Description of the change
Fixes #264. Now that
0.15.2is deployed to production, we can test the client out on the actual server vianpm run serve:production.Checklist: