Files
cypress/packages/server/lib/errors.ts
2022-02-18 17:34:37 -05:00

31 lines
698 B
TypeScript

import Bluebird from 'bluebird'
import errors from '@packages/errors'
import exception from './exception'
const isProduction = () => {
return process.env['CYPRESS_INTERNAL_ENV'] === 'production'
}
export const logException = Bluebird.method(function (this: any, err) {
// TODO: remove context here
if (this.log(err) && isProduction()) {
// log this exception since
// its not a known error
return exception
.create(err)
.catch(() => {})
}
})
export const get = errors.get
export const log = errors.log
export const warning = errors.warning
export const throwErr = errors.throwErr
export const cloneErr = errors.cloneErr
export const stripAnsi = errors.stripAnsi