فهرست منبع

do not print error on ctrl+c during prompts

Dax Raad 8 ماه پیش
والد
کامیت
0fc8dfc77e
2فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  1. 3 0
      packages/opencode/src/cli/error.ts
  2. 1 1
      packages/opencode/src/index.ts

+ 3 - 0
packages/opencode/src/cli/error.ts

@@ -1,5 +1,6 @@
 import { Config } from "../config/config"
 import { MCP } from "../mcp"
+import { UI } from "./ui"
 
 export function FormatError(input: unknown) {
   if (MCP.Failed.isInstance(input))
@@ -13,4 +14,6 @@ export function FormatError(input: unknown) {
         (issue) => "↳ " + issue.message + " " + issue.path.join("."),
       ) ?? []),
     ].join("\n")
+
+  if (UI.CancelledError.isInstance(input)) return ""
 }

+ 1 - 1
packages/opencode/src/index.ts

@@ -170,7 +170,7 @@ try {
   Log.Default.error("fatal", data)
   const formatted = FormatError(e)
   if (formatted) UI.error(formatted)
-  if (!formatted)
+  if (formatted === undefined)
     UI.error(
       "Unexpected error, check log file at " + Log.file() + " for more details",
     )