code: function formatResponseError(resp) {
      let result;
  
      if (resp.data.error) {
          result = resp.data.error.detail || resp.data.error;
      }
      else {
          result = resp.data.detail || JSON.stringify(resp.data);
      }
  
      return result.replace(/\n/g, '');
  }
docs: Find and format error in response object
  
  @param {object} resp HTTP response
  @returns {string} Error message