open-contracting / credere-backend

A tool that facilitates the participation of Micro, Small, and Medium businesses (MSMEs) in the Colombian public procurement market.
https://credere.readthedocs.io
BSD 3-Clause "New" or "Revised" License
5 stars 0 forks source link

Do not raise SkippedAwardError outside handle_skipped_award context #311

Closed jpmckinney closed 2 months ago

jpmckinney commented 2 months ago

While investigating fetch-all-awards-from-period I see that an SkippedAwardError was added in _get_awards_from_data_source 45c0f1ca

This exception class is raised by:

get_previous_awards_from_data_source and _create_complete_application use the context.

fetch_awards and fetch_all_awards_from_period do NOT use the context, so _get_awards_from_data_source should not raise this exception class. We can just raise a CredereError instead, to avoid misinterpretation. We could create a subclass for disambiguation, like SourceFormatError or something.

Or, if we want to allow processing to continue, we need to add handle_skipped_award inside the for-loop in _get_awards_from_data_source. That said, if keys are missing, it might be a sign that the response format has changed, in which case we would expect all awards to fail.