DavidD
tRPC17mo ago
7 replies
David

How to get line number in errors?

Hi, we are currently doing this:
onError: (info) => {
    if (isEnv("local")) {
      console.error(
        `${chalk.bgRed(`${info.error.name}: ${info.error.code}`)} - ${chalk.bgYellow(info.path)}\n${chalk.inverse(info.error.message)} \n`,
      )
    }
  },

to get a vague idea of what the error was, but this doesn't really help you with telling on which line it occurred. Is there a way to achieve this? Logging the trace is kind of pointless as they don't point you to your own procedure.
Was this page helpful?