1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00

refactor the 'CannotOverwriteExistingCassetteException' exception, building a more detailed message

The 'CannotOverwriteExistingCassetteException' exception now takes two kwargs, cassette and failed requests, in order to get the request(s) in the cassettes with the less differences and put those details in the exception message.
This commit is contained in:
Arthur Hamon
2019-06-12 13:24:13 +02:00
parent 396c4354e8
commit 28d9899b9b
3 changed files with 30 additions and 10 deletions

View File

@@ -75,10 +75,8 @@ def vcr_fetch_impl(cassette, real_fetch_impl):
request,
599,
error=CannotOverwriteExistingCassetteException(
"No match for the request (%r) was found. "
"Can't overwrite existing cassette (%r) in "
"your current record mode (%r)."
% (vcr_request, cassette._path, cassette.record_mode)
cassette=cassette,
failed_request=vcr_request
),
request_time=self.io_loop.time() - request.start_time,
)