method ErrorConstructor.captureStackTrace ErrorConstructor.captureStackTrace(error: Object,constructor?: Function,): void See https://v8.dev/docs/stack-trace-api#stack-trace-collection-for-custom-exceptions. Parameters error: Object optional constructor: Function Return Type void