import { formatStackTraceWithInternals } from './helpers' ; param err export function cleanUpStackTrace < T extends Error > ( err ) { if ( typeof process . env . TWILIO_SERVERLESS_FULL_ERRORS !== 'undefined' ) { return err ; } const backupPrepareStackTrace = Error . prepareStackTrace ; Error . prepareStackTrace = formatStackTraceWithInternals ; err . stack = err . stack ; Error . prepareStackTrace = backupPrepareStackTrace ; return err ; }