When Cleanup Fails After Another Error

A failed cleanup can add a second diagnostic after a primary operation has already failed. The result should keep enough context to explain both.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace a local export
  2. Check the reported chain

Trace a local export

Suppose generating text fails, then removing a temporary resource also fails because of an operating-system error. Callers need to know the export never succeeded and whether cleanup needs attention. See temporary file ownership.

Check the reported chain

A handler that replaces the primary failure can hide the first useful cause. Verify which exception is delivered under the language's chaining rules. Reading tracebacks explains where those causes appear.[1]

References

  1. Python Software Foundation, Python Tutorial: Errors and Exceptions ↩