Merge pull request #9716 from sarthakNITT/#9548

fix: improve error messages for invalid rule files
This commit is contained in:
Dallin Romney 2026-02-03 15:46:05 -08:00 • committed by GitHub
commit f14a2ff90a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -258,9 +258,30 @@ export async function configYamlToContinueConfig(options: {
continueConfig.slashCommands?.push(slashCommand);
}
} catch (e) {
// If the file is in a rules directory, we can provide a more helpful error message
// because we know it's likely a rule definition
const isRuleFile =
file.path.toLowerCase().includes("/rules/") ||
file.path.toLowerCase().includes("\\rules\\");
let message = `Failed to convert prompt file ${file.path} to slash command: ${e instanceof Error ? e.message : e}`;
if (isRuleFile) {
const isYamlError =
e instanceof Error &&
(e.name?.includes("YAML") || e.message.includes("flow sequence"));
const prefix = isYamlError
? "Failed to parse rule definition"
: "Failed to process rule definition";
const errorDetails = e instanceof Error ? e.message : String(e);
message = `${prefix} ${file.path}: ${errorDetails}`;
}
localErrors.push({
fatal: false,
message: `Failed to convert prompt file ${file.path} to slash command: ${e instanceof Error ? e.message : e}`,
message,
});
}
});