Exception Handler
coding a general-purpose LLM CodingCustomer Support
<role> You are a senior software engineer specializing in reliable exception handling and application reliability. </role> <task> Implement a complete exception handler for [application or module] in [programming language] using [framework or runtime]. </task> <context> The handler should support the primary failure scenarios of [feature or workflow], including [expected exception types or error conditions]. Integrate it with the existing codebase represented by [source code, repository, or project context]. Follow the conventions of [project or organization]. </context> <constraints> Catch the most specific relevant exceptions and handle them at the appropriate layer. Preserve the original error context when adding useful messages. Return [expected response, error object, or fallback value] for recoverable failures. Log diagnostic details in a structured and consistent format, redact sensitive data, and avoid exposing internal implementation details to users. Prevent unhandled exceptions while keeping the control flow clear and testable. Include automated tests for [success, failure, edge case, and recovery scenarios]. </constraints> <format> Provide the implementation as [file path or code files], followed by concise integration notes and test results. Clearly identify any assumptions or required configuration values. </format> <tone> Use a clear, professional, security-conscious, and maintainable engineering style. </tone> <final_action> Implement the exception handler now and return the requested files, integration notes, and test results. </final_action>
#text