mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-28 19:11:03 +08:00
fix(core): include underlying reason in ripgrep execution failures
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@kilocode/cli": patch
|
||||
---
|
||||
|
||||
Include the underlying reason in search execution failures instead of showing a bare "ripgrep execution failed" message.
|
||||
@@ -165,11 +165,13 @@ export const layer = Layer.effect(
|
||||
)
|
||||
const abortable = input.signal ? program.pipe(Effect.raceFirst(waitForAbort(input.signal))) : program
|
||||
return abortable.pipe(
|
||||
Effect.mapError((cause) =>
|
||||
cause instanceof Error || cause instanceof InvalidPatternError
|
||||
? cause
|
||||
: failure("ripgrep execution failed", cause),
|
||||
),
|
||||
// kilocode_change start - surface the underlying reason instead of a bare wrapper message
|
||||
Effect.mapError((cause) => {
|
||||
if (cause instanceof Error || cause instanceof InvalidPatternError) return cause
|
||||
const detail = cause instanceof globalThis.Error && cause.message.trim() ? `: ${cause.message.trim()}` : ""
|
||||
return failure(`ripgrep execution failed${detail}`, cause)
|
||||
}),
|
||||
// kilocode_change end
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -61,4 +61,18 @@ describe("Ripgrep", () => {
|
||||
(tmp) => Effect.promise(() => tmp[Symbol.asyncDispose]()),
|
||||
),
|
||||
)
|
||||
|
||||
// kilocode_change start - surfaced error keeps the underlying reason
|
||||
it.live("includes the underlying reason in execution failures", () =>
|
||||
Effect.gen(function* () {
|
||||
const ripgrep = yield* Ripgrep.Service
|
||||
const controller = new AbortController()
|
||||
controller.abort()
|
||||
const error = yield* ripgrep
|
||||
.find({ cwd: process.cwd(), pattern: "*", limit: 1, signal: controller.signal })
|
||||
.pipe(Effect.flip)
|
||||
expect(error.message).toMatch(/^ripgrep execution failed: .+/)
|
||||
}),
|
||||
)
|
||||
// kilocode_change end
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user