Skip to content

fix: descriptive error messages and dead code removal#11

Draft
Koan-Bot wants to merge 1 commit into
atoomic:masterfrom
Koan-Bot:koan.atoomic/improve-error-handling
Draft

fix: descriptive error messages and dead code removal#11
Koan-Bot wants to merge 1 commit into
atoomic:masterfrom
Koan-Bot:koan.atoomic/improve-error-handling

Conversation

@Koan-Bot

@Koan-Bot Koan-Bot commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

What

Replace all bare die statements with descriptive error messages and remove dead code.

Why

Silent die (without a message) gives users zero diagnostic info when something goes wrong — they see Died at Images.pm line 40 with no context about what argument was missing or what went wrong. This makes debugging OpenStack integration issues unnecessarily painful.

How

  • Images.pm: die unless defined $uiddie "image_from_uid: uid is required"
  • Service.pm: die unless ref $selfdie "setup_method must be called as an instance method"
  • Specs/Roles/Service.pm: die unless defined $methoddie "query_filters_for: method is required"
  • GetFromId.pm: Removed _get_from_id — the FIXME said "to delete once unused" and it was indeed unused (only _get_from_id_spec is called from spec-generated code)

Testing

  • New t/error-handling.t with 10 tests covering argument validation for: image_from_uid, image_from_name, create_vm (5 required args), look_by_id_or_name, and the constructor.
  • Full suite passes: 33 tests across 7 files.

🤖 Generated with Claude Code


Quality Report

Changes: 5 files changed, 120 insertions(+), 29 deletions(-)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

Bare `die` without a message gives zero diagnostic info when something
goes wrong. Replace all silent `die` calls with messages that identify
the method and the missing argument.

Also removes the unused `_get_from_id` method from GetFromId.pm (the
FIXME said "to delete once unused" — it was already unused, only
`_get_from_id_spec` is called from spec-generated code).

Adds error-path tests covering argument validation for image_from_uid,
image_from_name, create_vm, look_by_id_or_name, and the constructor.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant