UNPKG

inversify

Version:

A powerful and lightweight inversion of control container for JavaScript and Node.js apps powered by TypeScript.

17 lines (16 loc) 475 B
import * as ERROR_MSGS from '../constants/error_msgs'; export function isStackOverflowExeption(error) { return (error instanceof RangeError || error.message === ERROR_MSGS.STACK_OVERFLOW); } export var tryAndThrowErrorIfStackOverflow = function (fn, errorCallback) { try { return fn(); } catch (error) { if (isStackOverflowExeption(error)) { error = errorCallback(); } throw error; } };