Skip to content

Include response detail message upon HTTPError responses#302

Merged
iLLiCiTiT merged 4 commits intodevelopfrom
enhancement/report_error_details
Feb 5, 2026
Merged

Include response detail message upon HTTPError responses#302
iLLiCiTiT merged 4 commits intodevelopfrom
enhancement/report_error_details

Conversation

@BigRoy
Copy link
Contributor

@BigRoy BigRoy commented Feb 4, 2026

Changelog Description

Include response detail message upon HTTPError responses

Additional review information

This turns e.g. this:

ayon_api.exceptions.HTTPRequestError: 400 Client Error: Bad Request for url: http://localhost:5000/api/bundles/TEMP

Into:

ayon_api.exceptions.HTTPRequestError: 400 Client Error: Bad Request for url: http://localhost:5000/api/bundles/TEMP (Failed to validate bundle: nuke: core >=1.9.0 is required)

Which actually tells me exactly why it failed.

Testing notes:

  1. Confirm you like more details about your errors ;)

@BigRoy BigRoy self-assigned this Feb 4, 2026
@BigRoy BigRoy added the type: enhancement New feature or request label Feb 4, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances error messages for HTTP errors by extracting and including the 'detail' field from JSON error responses when available. This provides more descriptive error information to help developers understand why requests fail.

Changes:

  • Modified the raise_for_status method in the RestApiResponse class to extract and append the 'detail' field from JSON error responses to the error message

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@iLLiCiTiT iLLiCiTiT merged commit 5779dbc into develop Feb 5, 2026
2 checks passed
@iLLiCiTiT iLLiCiTiT deleted the enhancement/report_error_details branch February 5, 2026 08:44
@martastain
Copy link
Member

Too late to join - this is already great, but i'd like add two points:

  1. it would be great to see the original method that was used for the call.
ayon_api.exceptions.HTTPRequestError: 400 Client Error: Bad Request for [POST] http://localhost:5000/api/bundles/TEMP (Failed to validate bundle: nuke: core >=1.9.0 is required)

I witnessed situations, where the problem was caused by sending PUT instead of POST and vice versa. Usually, the detail will tell you "Method Not Allowed" , but there are endpoints that accept more HTTP methods.

  1. keep in mind that there may be additional information in the response, that could help you with debugging. maybe it could prettyprint the entire object with certain log level?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants