fix(config): name the rejected setting and its constraint in configuration errors
Every configuration failure projected the same message, "REA configuration is invalid. Run `rea doctor` and fix the reported setting.", with no details. The environment parser discarded the issue that names the variable (for example `REA_GHIDRA_NATIVEAOT_JAR must be absolute`), and doctor can report healthy for that environment, so neither the CLI, the MCP startup message, nor doctor told callers which setting to correct. ConfigurationError now carries the rejected settings and their constraints (never their values). The projection names them in its message, lists them in `details.settings`, and asks the caller to correct those settings where REA is started. Errors without a named setting keep the previous message. Fixes #1184 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e6abaefbbc
commit
0a0244db42
@@ -3,9 +3,27 @@ import {
|
||||
type AnalysisErrorOptions,
|
||||
} from "./analysisErrorBase.js";
|
||||
|
||||
/** One rejected configuration setting and the constraint it failed. */
|
||||
export interface ConfigurationSettingIssue {
|
||||
readonly setting: string;
|
||||
readonly constraint: string;
|
||||
}
|
||||
|
||||
/** Rejected settings retained for diagnostics; their values are not. */
|
||||
export interface ConfigurationErrorOptions extends AnalysisErrorOptions {
|
||||
readonly settings?: readonly ConfigurationSettingIssue[];
|
||||
}
|
||||
|
||||
/** Runtime configuration could not be parsed safely. */
|
||||
export class ConfigurationError extends AnalysisError {
|
||||
readonly _tag = "ConfigurationError";
|
||||
readonly settings: readonly ConfigurationSettingIssue[];
|
||||
constructor(message: string, options?: ConfigurationErrorOptions) {
|
||||
super(message, options);
|
||||
this.settings = (options?.settings ?? []).map(
|
||||
({ setting, constraint }) => ({ setting, constraint }),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/** No app or binary session exists for an analysis request. */
|
||||
|
||||
Reference in New Issue
Block a user