Skip to content

Commit 2bc6612

Browse files
fix: catch exception from fetch call when download Ripgrep binary
1 parent 847fc9d commit 2bc6612

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/opencode/src/file/ripgrep.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ export namespace Ripgrep {
145145
const filename = `ripgrep-${version}-${config.platform}.${config.extension}`
146146
const url = `https://github.com/BurntSushi/ripgrep/releases/download/${version}/${filename}`
147147

148-
const response = await fetch(url)
148+
const response = await fetch(url).catch((error:any) => {
149+
log.error(`Failed to download ripgrep from URL:${url}, error:${error?.message ?? String(error)}`)
150+
throw new DownloadFailedError({ url, status: -1 })
151+
})
149152
if (!response.ok) throw new DownloadFailedError({ url, status: response.status })
150153

151154
const arrayBuffer = await response.arrayBuffer()

0 commit comments

Comments
 (0)