Skip to content

Commit

Permalink
Merge pull request #63 from ParclLabs/bug/msg
Browse files Browse the repository at this point in the history
fix validation error messaging
  • Loading branch information
bhagyasharma authored Aug 30, 2024
2 parents 7423e49 + 90c8db9 commit c057f27
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### v1.6.0
- Bug fix for handling of 422 validation errors.

### v1.6.0
- Introduce `turbo_mode` - smart routing for premium api users to reduce latency for bulk data pulls.
- Bux fix on output dataframes - inconsistent column order.
Expand Down
2 changes: 1 addition & 1 deletion parcllabs/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "1.6.0"
VERSION = "1.6.1"
2 changes: 1 addition & 1 deletion parcllabs/services/parcllabs_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def error_handling(self, response: requests.Response) -> None:
error_message += " Visit https://dashboard.parcllabs.com for more information or reach out to [email protected]."
elif response.status_code == 422:
details = error_details.get("detail")
error_message = details.get("msg", "validation error")
error_message = details[0].get("msg", "validation error")
elif response.status_code == 429:
error_message = error_details.get("error", "Rate Limit Exceeded")
elif response.status_code == 404:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_price_feed_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def test_error_handling_422(self, service):
response = Mock()
response.status_code = 422
response.json.return_value = {
"detail": {'msg': 'Invalid input'},
"detail": [{'msg': 'Invalid input'}],
}
with pytest.raises(RequestException, match="422 Client Error"):
service.error_handling(response)
Expand Down

0 comments on commit c057f27

Please sign in to comment.