function wrapError(e, extra) {
  let message;

  if (e && e.response && e.response.body) {
    message = `${e.response.body.code} ${e.response.body.message}`;
  } else {
    message = e.message;
  }

  return new JSONRefError(`Could not resolve reference: ${message}`, {
    ...extra,
    cause: e,
  });
}
Wraps an error as JSONRefError.
@param  {Error} e      the error.
@param  {Object} extra (optional) optional data.
@return {Error}        an instance of JSONRefError.
@api public