Skip to content

Clarify error when cassette is missing in write-protected mode (#838) - #1027

Open
philsong4-ai wants to merge 2 commits into
kevin1024:masterfrom
philsong4-ai:fix/838-missing-cassette-message
Open

philsong4-ai wants to merge 2 commits into
kevin1024:masterfrom
philsong4-ai:fix/838-missing-cassette-message

Conversation

@philsong4-ai

Copy link
Copy Markdown

In record modes that forbid recording (e.g. 'none'), requesting an interaction that is not in the cassette raised
CannotOverwriteExistingCassetteException with the message "Can't overwrite existing cassette (...)". That wording is misleading when the cassette file does not actually exist yet.

Now the exception distinguishes the two cases:

  • The cassette file exists: the original 'Can't overwrite existing cassette' message is preserved (unchanged behavior).
  • The cassette file does not exist: a clearer message explains that the cassette is missing and the current record mode does not allow recording new requests.

The exception gains an optional 'message' argument so callers can supply an overridden message; existing call sites are unaffected.

Adds a regression test asserting the clearer message for #838.

…1024#838)

In record modes that forbid recording (e.g. 'none'), requesting an
interaction that is not in the cassette raised
CannotOverwriteExistingCassetteException with the message
"Can't overwrite existing cassette (...)". That wording is misleading
when the cassette file does not actually exist yet.

Now the exception distinguishes the two cases:
- The cassette file exists: the original 'Can't overwrite existing
  cassette' message is preserved (unchanged behavior).
- The cassette file does not exist: a clearer message explains that the
  cassette is missing and the current record mode does not allow
  recording new requests.

The exception gains an optional 'message' argument so callers can supply
an overridden message; existing call sites are unaffected.

Adds a regression test asserting the clearer message for kevin1024#838.
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