Skip to content

Conversation

@psafont
Copy link
Member

@psafont psafont commented Dec 9, 2025

This is done by using options and avoiding exceptions as much as possible, or using custom exceptions that help finding the cause.

@psafont psafont force-pushed the dev/pau/quality branch 6 times, most recently from 700e665 to 3829326 Compare December 16, 2025 13:30
@psafont psafont marked this pull request as draft December 16, 2025 14:32
@psafont
Copy link
Member Author

psafont commented Dec 16, 2025

Found an issue, I need to add a function in listext, with unit-tests

@psafont psafont force-pushed the dev/pau/quality branch 2 times, most recently from 83e0ec8 to 9504ce0 Compare December 16, 2025 15:45
This function is useful to apply a function to a list that may fail, it
returns the first error, or all the successful results.

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
This makes the exception much more recognizable and easier to locate.

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
These can be easily replaced with a match against the list, or changing
parameters to separate the head from the rest of the list

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
Previously an exception was raised for last, head is a new function.

Also adds a latest_release to datamodel_types that can't fail after the
module has been loaded. (the list is populated so it won't fail when the
module is loaded either)

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
This forces users to deal with None in the new code.

One of them is replace with the new function List.try_map that returns
the first error. While split_on_char never returns an empty list, it's a
good test for using try_map

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
The return type is the same, but it's more obvious to see what it does

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
@psafont psafont marked this pull request as ready for review December 16, 2025 16:22
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