fix: prevent [object Object] error display in console output (#8116)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -78,7 +78,7 @@ const FileTreeCommand = cmd({
|
|||||||
}),
|
}),
|
||||||
async handler(args) {
|
async handler(args) {
|
||||||
const files = await Ripgrep.tree({ cwd: args.dir, limit: 200 })
|
const files = await Ripgrep.tree({ cwd: args.dir, limit: 200 })
|
||||||
console.log(files)
|
console.log(JSON.stringify(files, null, 2))
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -624,7 +624,7 @@ export const GithubRunCommand = cmd({
|
|||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
exitCode = 1
|
exitCode = 1
|
||||||
console.error(e)
|
console.error(e instanceof Error ? e.message : String(e))
|
||||||
let msg = e
|
let msg = e
|
||||||
if (e instanceof $.ShellError) {
|
if (e instanceof $.ShellError) {
|
||||||
msg = e.stderr.toString()
|
msg = e.stderr.toString()
|
||||||
@@ -915,7 +915,7 @@ export const GithubRunCommand = cmd({
|
|||||||
|
|
||||||
// result should always be assistant just satisfying type checker
|
// result should always be assistant just satisfying type checker
|
||||||
if (result.info.role === "assistant" && result.info.error) {
|
if (result.info.role === "assistant" && result.info.error) {
|
||||||
console.error(result.info)
|
console.error("Agent error:", result.info.error)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`${result.info.error.name}: ${"message" in result.info.error ? result.info.error.message : ""}`,
|
`${result.info.error.name}: ${"message" in result.info.error ? result.info.error.message : ""}`,
|
||||||
)
|
)
|
||||||
@@ -944,7 +944,7 @@ export const GithubRunCommand = cmd({
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (summary.info.role === "assistant" && summary.info.error) {
|
if (summary.info.role === "assistant" && summary.info.error) {
|
||||||
console.error(summary.info)
|
console.error("Summary agent error:", summary.info.error)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`${summary.info.error.name}: ${"message" in summary.info.error ? summary.info.error.message : ""}`,
|
`${summary.info.error.name}: ${"message" in summary.info.error ? summary.info.error.message : ""}`,
|
||||||
)
|
)
|
||||||
@@ -962,7 +962,7 @@ export const GithubRunCommand = cmd({
|
|||||||
try {
|
try {
|
||||||
return await core.getIDToken("opencode-github-action")
|
return await core.getIDToken("opencode-github-action")
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to get OIDC token:", error)
|
console.error("Failed to get OIDC token:", error instanceof Error ? error.message : error)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"Could not fetch an OIDC token. Make sure to add `id-token: write` to your workflow permissions.",
|
"Could not fetch an OIDC token. Make sure to add `id-token: write` to your workflow permissions.",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ try {
|
|||||||
if (formatted) UI.error(formatted)
|
if (formatted) UI.error(formatted)
|
||||||
if (formatted === undefined) {
|
if (formatted === undefined) {
|
||||||
UI.error("Unexpected error, check log file at " + Log.file() + " for more details" + EOL)
|
UI.error("Unexpected error, check log file at " + Log.file() + " for more details" + EOL)
|
||||||
console.error(e)
|
console.error(e instanceof Error ? e.message : String(e))
|
||||||
}
|
}
|
||||||
process.exitCode = 1
|
process.exitCode = 1
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user