Skip to content

Commit bd33bbf

Browse files
committed
fix: API key validation now raises AuthenticationError instead of ValueError for invalid formats.
1 parent 4ff33a1 commit bd33bbf

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.1.6] - 2025-12-12
9+
10+
### Fixed
11+
12+
- Fixed API key validation to raise `AuthenticationError` instead of `ValueError` for invalid format, ensuring consistent error handling
13+
814
## [0.1.5] - 2025-12-12
915

1016
### Fixed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "brainus-ai"
7-
version = "0.1.5"
7+
version = "0.1.6"
88
description = "Official Python SDK for Brainus AI - RAG-powered educational content API"
99
readme = "README.md"
1010
license = {text = "MIT"}

src/brainus_ai/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(
4545
max_retries: Maximum number of retry attempts for failed requests
4646
"""
4747
if not api_key or not api_key.startswith("brainus_"):
48-
raise ValueError("Invalid API key format. Expected format: brainus_...")
48+
raise AuthenticationError("Invalid API key format. Expected format: brainus_...")
4949

5050
self.api_key = api_key
5151
self.base_url = base_url.rstrip("/")

0 commit comments

Comments
 (0)