Closed pinetops closed 5 months ago
I'll work up a branch to propose some changes. The goal isn't to have custom merging like this, but rather to leverage the existing to_class
logic, which handles this kind of thing already. Such that if you have an error from one of these other splodes, to_error
will leave it as is if its one of those other splode's errors, and to_class
will incorporate that error into its own logic (i.e using its own error class to categorize it.)
Also, we won't pull things out of their UnknownError
, only their error classes, so the tests will need to adjust to use an unknown error class. Any individual error should be retained from the other error source.
I've opened a PR here, to show what I had in mind. https://github.com/ash-project/splode/pull/8
Per discussion started on Slack.
I wanted to review a few decisions:
I didn't change splode_error?. The reasoning was that a) it's used in its current form in Ash so I wanted to be cautious about changing the behavior. b) the naming seems less than ideal given that it no longer answers the original question: new name is merge_error? And c) the function can pull both MODULE and the list of merge_with from the context without using arguments, that seemed to me to be a better interface.
I've made some assumptions about the data structure:
But in general it would be helpful to know what the range of valid possibilities for the error tree, and if there are more I need to cover (or indeed less)
Contributor checklist