l00k / devphase

Development tool for Phala Phat contracts.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Show suspicious log when error happened

h4x3rotab opened this issue · comments

When running yarn devphase contract test, it shows the error below:

  1) "before all" hook in "{root}"
[Test] Global teardown start
[Test] Stopping stack
[Test] Global teardown done

  0 passing (13s)
  1 failing

  1) "before all" hook in "{root}":
     Exception: Timeout
      at Timeout._onTimeout (node_modules/@devphase/service/dist/utils/timeout.js:11:50)
      at listOnTimeout (node:internal/timers:557:17)
      at processTimers (node:internal/timers:500:7)

Without additional explanation or context, it's hard to figure out why it got a timeout. After checking logs/<datetime>/pruntime.log, I found:

Failed to launch API server: Bind(Os { code: 98, kind: AddrInUse, message: "Address already in use" })

which is very helpful to diagnose the problem. Do you think it's possible to show the error the the user when it happens during setting up the stack? Or at least, give a pointer to the log file path so that the user can know where to check. E.g.:

You can find the logs here:
- Pruntime: logs/<datetime>/pruntime.log
- Node: logs/<datetime>/node.log
- ....
commented

Logs are not always saved - it can be modified via config file.
I think it would be good to present few lines from output of failing component.

Done in v0.6.3