Repository navigation
Expand file tree
/
Copy pathtool_errors.py
More file actions
58 lines (49 loc) · 2.39 KB
/
Copy pathtool_errors.py
File metadata and controls
58 lines (49 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from __future__ import annotations
# (H) Generic error wrapper
ERROR_WRAPPER = "Error: {message}"
# (H) File operation errors
FILE_NOT_FOUND = "File not found."
FILE_NOT_FOUND_OR_DIR = "File not found or is a directory: {path}"
BINARY_FILE = "File '{path}' is a binary file. Ask the user to attach it inline if they want it analyzed."
UNICODE_DECODE = (
"File '{path}' could not be read as text. It may be a binary file. "
"If it is a document (e.g., PDF), ask the user to attach it inline."
)
# (H) Directory errors
DIRECTORY_INVALID = "Error: '{path}' is not a valid directory."
DIRECTORY_EMPTY = "Error: The directory '{path}' is empty."
DIRECTORY_LIST_FAILED = "Error: Could not list contents of '{path}'."
DIRECTORY_PATH_OUTSIDE_ROOT = (
"Error: '{path}' is outside the project root ({root}). "
"Use a relative path from the project root, or the full absolute path within it."
)
# (H) Shell command errors
COMMAND_NOT_ALLOWED = "Command '{cmd}' is not in the allowlist.{suggestion} Available commands: {available}"
COMMAND_EMPTY = "Empty command provided."
COMMAND_DANGEROUS = "Rejected dangerous command: {cmd}"
COMMAND_DANGEROUS_BLOCKED = "Blocked dangerous command '{cmd}': {reason}"
COMMAND_DANGEROUS_PATTERN = "Command matches dangerous pattern: {reason}"
COMMAND_TIMEOUT = "Command '{cmd}' timed out after {timeout} seconds."
COMMAND_SUBSHELL_NOT_ALLOWED = "Subshell execution not allowed: {pattern}"
COMMAND_INVALID_SYNTAX = "Invalid command syntax: {segment}"
# (H) Code retrieval errors
CODE_ENTITY_NOT_FOUND = "Entity not found in graph."
CODE_MISSING_LOCATION = "Graph entry is missing location data."
# (H) File writer errors
FILE_WRITER_SECURITY = (
"Security risk: Attempted to create file outside of project root: {path}"
)
FILE_WRITER_CREATE = "Error creating file {path}: {error}"
# (H) Export errors
EXPORT_FAILED = "Failed to export graph: {error}"
# (H) MCP tool errors
MCP_TOOL_RETURNED_NONE = "Tool returned None"
MCP_INVALID_RESPONSE = "Code snippet tool returned an invalid response"
MCP_PATH_NOT_EXISTS = "Target repository path does not exist: {path}"
MCP_PATH_NOT_DIR = "Target repository path is not a directory: {path}"
MCP_PROJECT_NOT_FOUND = (
"Project '{project_name}' not found. Available projects: {projects}"
)
# (H) CLI validation errors
INVALID_POSITIVE_INT = "{value!r} is not a valid positive integer"
INVALID_NON_NEGATIVE_FLOAT = "Value must be non-negative, got {value}"