(result: ToolResultBlockParam['content'], options: {
progressMessagesForMessage: ProgressMessage[];
tools: Tools;
verbose: boolean;
})
| 126 | return <EditRejectionDiff filePath={filePath} oldString={oldString} newString={newString} replaceAll={replaceAll} style={style} verbose={verbose} />; |
| 127 | } |
| 128 | export function renderToolUseErrorMessage(result: ToolResultBlockParam['content'], options: { |
| 129 | progressMessagesForMessage: ProgressMessage[]; |
| 130 | tools: Tools; |
| 131 | verbose: boolean; |
| 132 | }): React.ReactElement { |
| 133 | const { |
| 134 | verbose |
| 135 | } = options; |
| 136 | if (!verbose && typeof result === 'string' && extractTag(result, 'tool_use_error')) { |
| 137 | const errorMessage = extractTag(result, 'tool_use_error'); |
| 138 | // Show a less scary message for intended behavior |
| 139 | if (errorMessage?.includes('File has not been read yet')) { |
| 140 | return <MessageResponse> |
| 141 | <Text dimColor>File must be read first</Text> |
| 142 | </MessageResponse>; |
| 143 | } |
| 144 | if (errorMessage?.includes(FILE_NOT_FOUND_CWD_NOTE)) { |
| 145 | return <MessageResponse> |
| 146 | <Text color="error">File not found</Text> |
| 147 | </MessageResponse>; |
| 148 | } |
| 149 | return <MessageResponse> |
| 150 | <Text color="error">Error editing file</Text> |
| 151 | </MessageResponse>; |
| 152 | } |
| 153 | return <FallbackToolUseErrorMessage result={result} verbose={verbose} />; |
| 154 | } |
| 155 | type RejectionDiffData = { |
| 156 | patch: StructuredPatchHunk[]; |
| 157 | firstLine: string | null; |
nothing calls this directly
no test coverage detected