Bubble a routine's error status up to the program status.
(program_status, routine_status)
| 284 | |
| 285 | |
| 286 | def bubble_error(program_status, routine_status) -> int: |
| 287 | """Bubble a routine's error status up to the program status.""" |
| 288 | # A non-OK error status overrides an OK error status. |
| 289 | if routine_status == STATUS_OK: |
| 290 | return program_status |
| 291 | elif program_status == STATUS_OK: |
| 292 | return routine_status |
| 293 | else: |
| 294 | return min(program_status, routine_status) |
| 295 | |
| 296 | |
| 297 | def main() -> int: |