fix(targets): project invalid raw-binary loads as caller input (#2004)
* fix(targets): project invalid raw-binary loads as caller input * fix(targets): name real load options and cover DOS COM kind pairing
This commit is contained in:
@@ -76,6 +76,11 @@ export const analysisErrorRemediationAction = (
|
||||
error.constraint === "directory_requires_file"
|
||||
)
|
||||
return "For a JavaScript/Electron application directory, call analyze_javascript_application with input_path or run `rea analyze <directory>`. For binary analysis, select its executable file.";
|
||||
if (
|
||||
error instanceof BinaryTargetError &&
|
||||
error.constraint === "load_selection_rejected"
|
||||
)
|
||||
return "Correct the reported load argument (--target-format, --architecture, or --entry-point on the CLI; format, architecture, or entry_point through MCP) and retry.";
|
||||
if (
|
||||
error instanceof BinaryTargetError &&
|
||||
error.constraint === "file_format_rejected"
|
||||
@@ -105,6 +110,11 @@ export const analysisErrorRemediationAction = (
|
||||
export const analysisErrorCategory = (
|
||||
error: AnalysisError,
|
||||
): AnalysisErrorProjection["category"] => {
|
||||
if (
|
||||
error instanceof BinaryTargetError &&
|
||||
error.constraint === "load_selection_rejected"
|
||||
)
|
||||
return "invalid_input";
|
||||
if (
|
||||
error instanceof BinaryTargetError &&
|
||||
(error.constraint === "wasm_requires_static_inspection" ||
|
||||
@@ -237,7 +247,8 @@ export const analysisErrorUserMessage = (error: AnalysisError): string => {
|
||||
if (error instanceof BinaryTargetError)
|
||||
return error.constraint === "directory_requires_file"
|
||||
? "open_binary accepts files and macOS app bundles. This target is a directory; JavaScript/Electron application directories can be analyzed directly with analyze_javascript_application or `rea analyze <directory>`."
|
||||
: error.constraint === "file_format_rejected"
|
||||
: error.constraint === "file_format_rejected" ||
|
||||
error.constraint === "load_selection_rejected"
|
||||
? `${error.message}.`
|
||||
: `${error.message}. Check that the path exists, is readable, and points to a supported file.`;
|
||||
if (error._tag === "ProcessCaptureError")
|
||||
|
||||
Reference in New Issue
Block a user