Skip to content
Discussion options

You must be logged in to vote

Hi @evrys! I'm Dosu and I’m helping the orpc team.

You can log underlying errors and stack traces in ORPC by adding custom error handling middleware or using the onError interceptor when setting up your OpenAPIHandler. By default, ORPC hides error details for security, but you can intercept errors and log them before they're sent to the client.

Here's a pattern you can use:

import { onError, ORPCError } from '@orpc/server';

const handler = new OpenAPIHandler(router, {
  interceptors: [
    onError((error) => {
      // Log the full error and stack trace
      console.error('ORPC Internal Error:', error);
      if (error instanceof ORPCError && error.cause) {
        console.error('Under…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@evrys
Comment options

Answer selected by evrys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant