Skip to content

Expose the failure on the exception the client raises #97

Closed

Description

@flavorjones

Motivation

The client raises the application's own exception classes with failure.to_s as the message (client.rb:203). An application that needs the failure's code or cause must parse the message. HEY does exactly that to show a lock placeholder for a password-protected PDF: it matches mutool's stderr inside the message (encryption_aware_pdf_previewer.rb:27).

Urgency

Low. Nothing is broken today, because Codes documents the message format. This change matters once a cell sends causes an application acts on, such as the protected cause in #96. Without it, an application still has to parse the message to read that cause.

Implementation suggestion

Donal's carry-the-failure branch (4cdf8fa1) extends each raised exception with a HotCell::Verdict module. The module exposes the HotCell::Failure as hot_cell_failure, so an application reads error.hot_cell_failure.cause. It can also rescue HotCell::Verdict, whatever classes its registration injected. The branch includes tests in hotcell-client/test/classification_test.rb. To finish it, rebase onto master, document the module in docs/client-api.md and docs/codes.md, and add a changelog entry.

Activity

  1. added 2 commits that reference this issue on Oct 7, 2026
    87ef1a2
    572ab89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions