UNPKG

growthbook

Version:

The GrowthBook command-line interface (CLI) for working with the GrowthBook A/B testing, feature flagging, and experimentation platform

20 lines (19 loc) 678 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.errorStringFromResponse = void 0; /** * Parses the Axios error object based on the GrowthBook public API error response * @param error {AxiosError} * @return error message {string} */ const errorStringFromResponse = (error) => { var _a, _b; const defaultErrorMessage = 'unknown error'; try { return ((_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message) || defaultErrorMessage; } catch { return defaultErrorMessage; } }; exports.errorStringFromResponse = errorStringFromResponse;