Skip to content

Commit 952eb18

Browse files
committed
fix: add message attribute to BrainusError for improved exception handling
1 parent 86e80ae commit 952eb18

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Fixed
1111

1212
- Fixed API key validation to raise `AuthenticationError` instead of `ValueError` for invalid format, ensuring consistent error handling
13+
- Added `message` attribute to all Brainus AI exceptions to support `e.message` access pattern
1314

1415
## [0.1.5] - 2025-12-12
1516

src/brainus_ai/exceptions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
class BrainusError(Exception):
55
"""Base exception for all Brainus AI errors."""
66

7-
pass
7+
def __init__(self, message: str, *args: object) -> None:
8+
super().__init__(message, *args)
9+
self.message = message
810

911

1012
class AuthenticationError(BrainusError):

0 commit comments

Comments
 (0)