Skip to content

Commit

Permalink
Merge pull request #137 from microsoft/bugfix/error-string
Browse files Browse the repository at this point in the history
Bugfix/error string
  • Loading branch information
samwelkanda authored Sep 13, 2023
2 parents 9a7df7c + 9d574c0 commit 95d61d4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.8.3] - 2023-09-13

### Added

### Changed
- Fix error representation when APIError class has no error attribute.

## [0.8.2] - 2023-09-13

### Added
Expand Down
2 changes: 1 addition & 1 deletion kiota_abstractions/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION: str = "0.8.2"
VERSION: str = "0.8.3"
14 changes: 13 additions & 1 deletion kiota_abstractions/api_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,16 @@ class APIError(Exception):
response_headers: Optional[Dict[str, str]] = None

def __str__(self) -> str:
return f"""APIError {self.response_status_code}: {self.message} {getattr('error', '')}"""
error = getattr(self, "error", None)
if error:
return f"""
APIError
Code: {self.response_status_code}
message: {self.message}
error: {error}
"""
return f"""
APIError
Code: {self.response_status_code}
message: {self.message}
"""

0 comments on commit 95d61d4

Please sign in to comment.