From 6f2fbc976283b8444e472f3323056b9f8ced8c80 Mon Sep 17 00:00:00 2001 From: Nico Schett <52858351+schettn@users.noreply.github.com> Date: Thu, 4 Jul 2024 17:04:26 +0000 Subject: [PATCH] feat: add error cause to ServiceError closes #2 --- packages/pylon/src/define-pylon.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/pylon/src/define-pylon.ts b/packages/pylon/src/define-pylon.ts index 77e719e..1423088 100644 --- a/packages/pylon/src/define-pylon.ts +++ b/packages/pylon/src/define-pylon.ts @@ -373,9 +373,13 @@ export class ServiceError extends GraphQLError { code: string statusCode: number details?: Record - } + }, + error?: Error ) { - super(message) + super(message, { + originalError: error + }) this.extensions = extensions + this.cause = error } }