Add top‑level exception handler to pb-dydns.php for cleaner CLI failures #7

Open
opened 2026-04-07 11:03:41 +01:00 by mon · 0 comments
Owner

If Config or other components throw an exception, the CLI script currently prints a PHP stack trace. Adding a top‑level try/catch block would allow the script to fail gracefully with a clear message and a consistent exit code.

Proposed behavior

  • Wrap the main script body in a try/catch
  • Print a concise error message on failure
  • Exit with a non‑zero status code
  • Avoid exposing stack traces to end users

Benefits

  • Cleaner CLI output
  • More predictable behavior in cron/systemd
  • Better UX for non‑technical users

Notes

  • No changes to internal logic
  • Should be covered by a small test verifying exit code and output
If `Config` or other components throw an exception, the CLI script currently prints a PHP stack trace. Adding a top‑level `try/catch` block would allow the script to fail gracefully with a clear message and a consistent exit code. **Proposed behavior** - Wrap the main script body in a try/catch - Print a concise error message on failure - Exit with a non‑zero status code - Avoid exposing stack traces to end users **Benefits** - Cleaner CLI output - More predictable behavior in `cron`/`systemd` - Better UX for non‑technical users **Notes** - No changes to internal logic - Should be covered by a small test verifying exit code and output
mon self-assigned this 2026-04-07 11:03:55 +01:00
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
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: mon/pb-dydns#7
No description provided.