Просмотр исходного кода

core: improve error handling with console output for debugging

Dax Raad 4 месяцев назад
Родитель
Сommit
7a20f77ebf
2 измененных файлов с 5 добавлено и 1 удалено
  1. 1 0
      packages/opencode/script/build.ts
  2. 4 1
      packages/opencode/src/index.ts

+ 1 - 0
packages/opencode/script/build.ts

@@ -40,6 +40,7 @@ for (const [os, arch] of targets) {
   await $`tar -xf ../../node_modules/${watcher.replace("@parcel/", "parcel-")}-*.tgz -C ../../node_modules/${watcher} --strip-components=1`
   await $`tar -xf ../../node_modules/${watcher.replace("@parcel/", "parcel-")}-*.tgz -C ../../node_modules/${watcher} --strip-components=1`
 
 
   await Bun.build({
   await Bun.build({
+    sourcemap: true,
     compile: {
     compile: {
       target: `bun-${os}-${arch}` as any,
       target: `bun-${os}-${arch}` as any,
       outfile: `dist/${name}/bin/opencode`,
       outfile: `dist/${name}/bin/opencode`,

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

@@ -129,7 +129,10 @@ try {
   Log.Default.error("fatal", data)
   Log.Default.error("fatal", data)
   const formatted = FormatError(e)
   const formatted = FormatError(e)
   if (formatted) UI.error(formatted)
   if (formatted) UI.error(formatted)
-  if (formatted === undefined) UI.error("Unexpected error, check log file at " + Log.file() + " for more details")
+  if (formatted === undefined) {
+    UI.error("Unexpected error, check log file at " + Log.file() + " for more details\n")
+    console.error(e)
+  }
   process.exitCode = 1
   process.exitCode = 1
 }
 }