[PR #151] [MERGED] [cli] Exit with a non-zero code when a run fails #156

Closed
opened 2026-10-13 19:48:06 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Glitchy-Sheep/boosty-downloader/pull/151
Author: @Glitchy-Sheep
Created: 8/15/2026
Status: ✅ Merged
Merged: 8/15/2026
Merged by: @Glitchy-Sheep

Base: main ← Head: fix/error-exit-codes


📝 Commits (1)

  • 7789e7b fix: Exit with a non-zero code when a run fails

📊 Changes

3 files changed (+76 additions, -0 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 boosty_downloader/main.py (+11 -0)
➕ test/unit/cli/exit_codes_test.py (+64 -0)

📄 Description

Summary

Every handled error printed a readable message and then exited with code 0 - for shell scripts, cron jobs and CI the app always "succeeded". Now every error branch exits 1, Ctrl+C exits 130, and a clean run still exits 0.

Problem

  • The top-level error ladder in entry_point() logged nicely and fell through: $? was 0 after "author not found", "Unauthorized", network failures and even the failure-streak stop
  • boosty-downloader download ... && next-step happily ran next-step after a completely failed run

Fix

  • All nine error branches end with sys.exit(1); messages are untouched
  • ApplicationCancelledError (Ctrl+C) exits 130 - the shell convention for an interrupted run (128 + SIGINT)
  • sys.exit instead of typer.Exit on purpose: the ladder lives outside the typer app, where typer.Exit would go unhandled

Verification

  • Live: check --username <nonexistent> exits 1 (was 0); --version exits 0
  • 5 unit tests: parametrized errors exit 1, cancel exits 130, a clean run exits quietly
  • Full task check and 129 unit tests green

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Glitchy-Sheep/boosty-downloader/pull/151 **Author:** [@Glitchy-Sheep](https://github.com/Glitchy-Sheep) **Created:** 8/15/2026 **Status:** ✅ Merged **Merged:** 8/15/2026 **Merged by:** [@Glitchy-Sheep](https://github.com/Glitchy-Sheep) **Base:** `main` ← **Head:** `fix/error-exit-codes` --- ### 📝 Commits (1) - [`7789e7b`](https://github.com/Glitchy-Sheep/boosty-downloader/commit/7789e7b23e913bc45889272f2cff8544b66cadf5) fix: Exit with a non-zero code when a run fails ### 📊 Changes **3 files changed** (+76 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `boosty_downloader/main.py` (+11 -0) ➕ `test/unit/cli/exit_codes_test.py` (+64 -0) </details> ### 📄 Description ## Summary Every handled error printed a readable message and then exited with code 0 - for shell scripts, cron jobs and CI the app always "succeeded". Now every error branch exits 1, Ctrl+C exits 130, and a clean run still exits 0. ## Problem - The top-level error ladder in `entry_point()` logged nicely and fell through: `$?` was 0 after "author not found", "Unauthorized", network failures and even the failure-streak stop - `boosty-downloader download ... && next-step` happily ran `next-step` after a completely failed run ## Fix - All nine error branches end with `sys.exit(1)`; messages are untouched - `ApplicationCancelledError` (Ctrl+C) exits 130 - the shell convention for an interrupted run (128 + SIGINT) - `sys.exit` instead of `typer.Exit` on purpose: the ladder lives outside the typer app, where `typer.Exit` would go unhandled ## Verification - Live: `check --username <nonexistent>` exits 1 (was 0); `--version` exits 0 - 5 unit tests: parametrized errors exit 1, cancel exits 130, a clean run exits quietly - Full `task check` and 129 unit tests green --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-13 19:48:06 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Glitchy-Sheep/boosty-downloader#156
No description provided.