onQueryError method

  1. @override
void onQueryError(
  1. QueryErrorEvent event
)
override

Called when a query fails.

Implementation

@override
void onQueryError(QueryErrorEvent event) {
  if (!Sentry.isEnabled) return;
  Sentry.captureException(
    event.error,
    stackTrace: event.stackTrace,
    withScope: (scope) {
      scope.setContexts('prisma_query', {
        if (event.operation != null) 'operation': event.operation,
        if (event.model != null) 'model': event.model,
        'sql': event.sql,
        'durationMs': event.duration.inMilliseconds,
        if (includeParameters) 'parameters': event.parameters.toString(),
      });
    },
  );
}