from vcr.request import Request
+class CannotOverwriteExistingCassetteException(Exception):
+ pass
+
+
def parse_headers(header_list):
headers = "".join(header_list) + "\r\n"
msg = HTTPMessage(StringIO(headers))
return VCRHTTPResponse(response)
else:
if self.cassette.write_protected:
- raise Exception(
- "Can't overwrite existing cassette in \
- your current record mode."
+ raise CannotOverwriteExistingCassetteException(
+ "Can't overwrite existing cassette (%r) in "
+ "your current record mode (%r)."
+ % (self.cassette._path, self.cassette.record_mode)
)
# Otherwise, we should send the request, then get the response