Skip to content

feat: add describe_decode_error and describe_decode_errors function to decode module#909

Open
bcpeinhardt wants to merge 5 commits intogleam-lang:mainfrom
bcpeinhardt:bcpeinhardt/describe-error-in-decode
Open

feat: add describe_decode_error and describe_decode_errors function to decode module#909
bcpeinhardt wants to merge 5 commits intogleam-lang:mainfrom
bcpeinhardt:bcpeinhardt/describe-error-in-decode

Conversation

@bcpeinhardt
Copy link

There currently isn't a user facing describe_error style function for the decode module. I really like the describe_error pattern that's popped up in Gleam, especially for using the snag package. However, decode.run returns a list of decode errors. In this PR, I've added both a describe_decode_error and describe_decode_errors function. This makes using the result of a decode.run with an ad-hoc error type more ergonomic.

Ideally, packages like gleam_json could build on this to provide their own describe_error functions. Let me know what you think!

@lpil
Copy link
Member

lpil commented Mar 7, 2026

Hello! Any additions needs to be discussed and a design agreed on prior to implementation.

Please open an issue that details the motivations, use cases, and alternatives that have been considered 🙏

@bcpeinhardt
Copy link
Author

@lpil done 😎

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.

2 participants