"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _get = _interopRequireDefault(require("lodash/get"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const getMessage = error => {
  const message = (0, _get.default)(error, 'message');
  const data = (0, _get.default)(error, ['response', 'data']);
  const parts = [message, typeof data === 'string' ? data : null];
  return parts.filter(part => !!part).join(': ');
};
var _default = error => {
  const errorMessage = getMessage(error);
  const internalError = error.error;
  const internalErrorMessage = internalError ? getMessage(internalError) : null;
  const parts = [errorMessage, internalErrorMessage];
  return parts.filter(part => !!part).join(': ');
};
exports.default = _default;