Idiom for partial failures
Ethan Furman
ethan at stoneleaf.us
Sat Feb 22 16:10:05 EST 2020
On 02/21/2020 02:51 PM, Rob Gaddi wrote:
> On 2/21/20 9:18 AM, David Wihl wrote:
>> Yes, the API has to support partial failures across all six supported
>> languages. Not all operations need to be atomic and there is considerable
>> efficiency in having multiple operations sent in a single request. Thanks,
>
> A partial failure is a partial success and should not trigger a mandatory flow-control change, which is what an exception is.
Whether it should or not is a design question which won't always have the same answer.
> If there is any information in the successes, then I'd expect an operation like this to return me a list corresponding 1-to-1 with the list of operations
Sure, if there is processing still needed for the successes then that is the way I would choose, also.
> If successes have nothing to add to the party, then I'd expect the operation to return a list containing only the errors, and an empty list means no errors.
I would go the exception route here, for two reasons:
- the code that handles failures is very obviously in one place
- the program won't run merrily along if I forget to handle the failure case
(an exception would draw attention to the problem)
--
~Ethan~
More information about the Python-list
mailing list