action: from_yaml_file() doesn't handle file reading exceptions #10541

Open
opened 2026-04-18 17:07:24 +00:00 by HAL9000 · 0 comments
Owner

Metadata

  • Commit: Current HEAD
  • Branch: main
  • File: src/cleveragents/action/schema.py
  • Lines: 376-381

Background and Context

The from_yaml_file() method calls filepath.read_text() without try-except exception handling. If the file cannot be read (permission denied, encoding error, file not found, etc.), the exception is propagated without a clear error message about the file reading failure.

Expected Behavior

The from_yaml_file() method should catch file reading exceptions (FileNotFoundError, PermissionError, UnicodeDecodeError, etc.) and raise a clear, actionable error message that indicates the file reading failed and shows the underlying error details.

Acceptance Criteria

  • from_yaml_file() catches file reading exceptions
  • Clear error message indicates file reading failure
  • Error message includes the file path and underlying error details
  • Existing tests pass with exception handling added
  • New tests verify error handling for various file reading failures

Subtasks

  • Add try-except block around filepath.read_text() call
  • Catch FileNotFoundError, PermissionError, UnicodeDecodeError, and OSError
  • Create custom exception or raise ValueError with clear message
  • Include file path and original exception details in error message
  • Add test cases for various file reading failures

Definition of Done

  • from_yaml_file() handles file reading exceptions gracefully
  • Error messages are clear and actionable
  • All tests pass
  • Code review approved

Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata - **Commit**: Current HEAD - **Branch**: main - **File**: src/cleveragents/action/schema.py - **Lines**: 376-381 ## Background and Context The from_yaml_file() method calls filepath.read_text() without try-except exception handling. If the file cannot be read (permission denied, encoding error, file not found, etc.), the exception is propagated without a clear error message about the file reading failure. ## Expected Behavior The from_yaml_file() method should catch file reading exceptions (FileNotFoundError, PermissionError, UnicodeDecodeError, etc.) and raise a clear, actionable error message that indicates the file reading failed and shows the underlying error details. ## Acceptance Criteria - [ ] from_yaml_file() catches file reading exceptions - [ ] Clear error message indicates file reading failure - [ ] Error message includes the file path and underlying error details - [ ] Existing tests pass with exception handling added - [ ] New tests verify error handling for various file reading failures ## Subtasks - [ ] Add try-except block around filepath.read_text() call - [ ] Catch FileNotFoundError, PermissionError, UnicodeDecodeError, and OSError - [ ] Create custom exception or raise ValueError with clear message - [ ] Include file path and original exception details in error message - [ ] Add test cases for various file reading failures ## Definition of Done - from_yaml_file() handles file reading exceptions gracefully - Error messages are clear and actionable - All tests pass - Code review approved --- **Automated by CleverAgents Bot** Agent: new-issue-creator
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#10541
No description provided.