Skip to content

feat: enhance error handling with detailed logging and structured err… #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2025

Conversation

demeyerthom
Copy link
Member

This pull request introduces enhanced error handling and logging capabilities across the codebase. The changes include defining a new Error model, updating error extraction logic to provide more detailed error messages, and adding structured error definitions to the OpenAPI specification.

Error Handling Enhancements:

  • Added Error model to SDK: Defined a new Error struct in internal/sdk/main.gen.go to represent API error responses, including fields for Details, Message, RequestId, and Sys.
  • Improved error extraction logic: Updated the ExtractErrorResponse function in internal/utils/client.go to parse API error responses into the new Error model, log serialization issues, and include structured error details in the output.

Logging Improvements:

  • Enhanced error logging: Added better error logging to include descriptive messages and additional details, as documented in .changes/unreleased/Fixed-20250613-111754.yaml.
  • Integrated logging library: Imported the terraform-plugin-log/tflog package in internal/utils/client.go for structured logging.

OpenAPI Specification Updates:

  • Defined Error schema: Added an Error object definition to the OpenAPI specification in openapi.yaml, ensuring consistency between the API contract and the new Error model.

@demeyerthom demeyerthom requested a review from a team as a code owner June 13, 2025 09:19
@demeyerthom demeyerthom merged commit f55ed2a into main Jun 13, 2025
4 checks passed
@demeyerthom demeyerthom deleted the fix/error-logging branch June 13, 2025 10:00
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