fix: error name tweaks
This commit is contained in:
parent
5e60a13322
commit
3541eb987f
6 changed files with 23 additions and 22 deletions
|
|
@ -27,23 +27,24 @@ export enum ContinueErrorReason {
|
|||
FindAndReplaceMissingNewString = "find_and_replace_missing_new_string",
|
||||
FindAndReplaceOldStringNotFound = "find_and_replace_old_string_not_found",
|
||||
FindAndReplaceMultipleOccurrences = "find_and_replace_multiple_occurrences",
|
||||
|
||||
// File path errors
|
||||
FindAndReplaceMissingFilepath = "find_and_replace_missing_filepath",
|
||||
FindAndReplaceFileNotFound = "find_and_replace_file_not_found",
|
||||
FindAndReplaceFileAlreadyExists = "find_and_replace_file_already_exists",
|
||||
|
||||
// Multi-edit specific errors
|
||||
// Multi-edit
|
||||
MultiEditEditsArrayRequired = "multi_edit_edits_array_required",
|
||||
MultiEditEditsArrayEmpty = "multi_edit_edits_array_empty",
|
||||
MultiEditSubsequentEditsOnCreation = "multi_edit_subsequent_edits_on_creation",
|
||||
MultiEditEmptyOldStringNotFirst = "multi_edit_empty_old_string_not_first",
|
||||
|
||||
// CLI-specific errors
|
||||
EditToolFileNotRead = "edit_tool_file_not_read",
|
||||
CliParentDirectoryNotFound = "cli_parent_directory_not_found",
|
||||
CliFileWriteError = "cli_file_write_error",
|
||||
// General Edit
|
||||
EditToolFileNotRead = "edit_tool_file_not_yet_read",
|
||||
|
||||
// General File
|
||||
FileAlreadyExists = "file_already_exists",
|
||||
FileNotFound = "file_not_found",
|
||||
FileWriteError = "file_write_error",
|
||||
ParentDirectoryNotFound = "parent_directory_not_found",
|
||||
|
||||
// Other
|
||||
Unspecificied = "unspecified",
|
||||
Unknown = "unknown",
|
||||
}
|
||||
|
|
|
|||
10
extensions/cli/package-lock.json
generated
10
extensions/cli/package-lock.json
generated
|
|
@ -236,11 +236,11 @@
|
|||
},
|
||||
"../../packages/config-yaml": {
|
||||
"name": "@continuedev/config-yaml",
|
||||
"version": "1.0.96",
|
||||
"version": "1.17.0",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "file:../config-types",
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
"yaml": "^2.6.1",
|
||||
"zod": "^3.24.2"
|
||||
},
|
||||
|
|
@ -264,15 +264,15 @@
|
|||
},
|
||||
"../../packages/openai-adapters": {
|
||||
"name": "@continuedev/openai-adapters",
|
||||
"version": "1.5.1",
|
||||
"version": "1.15.0",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-bedrock-runtime": "^3.842.0",
|
||||
"@aws-sdk/credential-providers": "^3.840.0",
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
"@continuedev/config-yaml": "^1.8.0",
|
||||
"@continuedev/fetch": "^1.0.16",
|
||||
"@continuedev/config-yaml": "^1.14.0",
|
||||
"@continuedev/fetch": "^1.1.0",
|
||||
"dotenv": "^16.5.0",
|
||||
"google-auth-library": "^10.1.0",
|
||||
"json-schema": "^0.4.0",
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ WARNINGS:
|
|||
// Check if file exists
|
||||
if (!fs.existsSync(resolvedPath)) {
|
||||
throw new ContinueError(
|
||||
ContinueErrorReason.FindAndReplaceFileNotFound,
|
||||
ContinueErrorReason.FileNotFound,
|
||||
`File ${file_path} does not exist`,
|
||||
);
|
||||
}
|
||||
|
|
@ -204,7 +204,7 @@ WARNINGS:
|
|||
throw error;
|
||||
}
|
||||
throw new ContinueError(
|
||||
ContinueErrorReason.CliFileWriteError,
|
||||
ContinueErrorReason.FileWriteError,
|
||||
`Error: failed to edit ${args.resolvedPath}: ${
|
||||
error instanceof Error ? error.message : String(error)
|
||||
}`,
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ function validateFileAccess(
|
|||
const parentDir = path.dirname(resolvedPath);
|
||||
if (parentDir && !fs.existsSync(parentDir)) {
|
||||
throw new ContinueError(
|
||||
ContinueErrorReason.CliParentDirectoryNotFound,
|
||||
ContinueErrorReason.ParentDirectoryNotFound,
|
||||
`Parent directory does not exist: ${parentDir}`,
|
||||
);
|
||||
}
|
||||
|
|
@ -110,7 +110,7 @@ function validateFileAccess(
|
|||
}
|
||||
if (!fs.existsSync(resolvedPath)) {
|
||||
throw new ContinueError(
|
||||
ContinueErrorReason.FindAndReplaceFileNotFound,
|
||||
ContinueErrorReason.FileNotFound,
|
||||
`File ${resolvedPath} does not exist`,
|
||||
);
|
||||
}
|
||||
|
|
@ -306,7 +306,7 @@ WARNINGS:
|
|||
throw error;
|
||||
}
|
||||
throw new ContinueError(
|
||||
ContinueErrorReason.CliFileWriteError,
|
||||
ContinueErrorReason.FileWriteError,
|
||||
`Error: failed to edit ${args.file_path}: ${
|
||||
error instanceof Error ? error.message : String(error)
|
||||
}`,
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export const multiEditImpl: ClientToolImpl = async (
|
|||
if (isCreatingNewFile) {
|
||||
if (resolvedUri) {
|
||||
throw new ContinueError(
|
||||
ContinueErrorReason.FindAndReplaceFileAlreadyExists,
|
||||
ContinueErrorReason.FileAlreadyExists,
|
||||
`file ${filepath} already exists, cannot create new file`,
|
||||
);
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ export const multiEditImpl: ClientToolImpl = async (
|
|||
} else {
|
||||
if (!resolvedUri) {
|
||||
throw new ContinueError(
|
||||
ContinueErrorReason.FindAndReplaceFileNotFound,
|
||||
ContinueErrorReason.FileNotFound,
|
||||
`file ${filepath} does not exist. If you are trying to edit it, correct the filepath. If you are trying to create it, you must pass old_string=""`,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export const singleFindAndReplaceImpl: ClientToolImpl = async (
|
|||
);
|
||||
if (!resolvedFilepath) {
|
||||
throw new ContinueError(
|
||||
ContinueErrorReason.FindAndReplaceFileNotFound,
|
||||
ContinueErrorReason.FileNotFound,
|
||||
`File ${filepath} does not exist`,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue