Skip to content

fix uncaught exception on bad raw text value being encoded#11

Open
tsloughter wants to merge 1 commit intomainfrom
uncaught-badarg-raw
Open

fix uncaught exception on bad raw text value being encoded#11
tsloughter wants to merge 1 commit intomainfrom
uncaught-badarg-raw

Conversation

@tsloughter
Copy link
Copy Markdown
Owner

No description provided.

@tsloughter
Copy link
Copy Markdown
Owner Author

I'm not sure I want to keep the match on error:badarg. I purposely limited it to matching on error:function_clause in order to not sort of hide logic errors in pg_types that are unrelated to what the user's arguments are.

Thinking about it more again I think this does need to change and sadly we just have to keep updating type modules to ensure they'll throw function_clause exceptions (so adding guards) if the user passes args that won't encode properly.

Maybe this won't be as bad if in pgo we also change to actually match on the returned map and in cases it doesn't match that map error expected from pg_types it will continue to raise the exceptions. That way the user won't just get {error, badarg} but a full exception of what went wrong when trying to encode.

Does that make sense @lpil? I'm not sure how Gleam interop works with exceptions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant