packages/strapi-plugin-settings-manager/public/app/utils/request.js
/**
 * Checks if a network request came back fine, and throws an error if not
 *
 * @param  {object} response   A response from a network request
 *
 * @return {Promise} Returns either the response, or throws an error
 */
Checks if a network request came back fine, and throws an error if not
@param  {object} response   A response from a network request

@return {Promise} Returns either the response, or throws an error
Checks if a network request came back fine and throws an error if not @param { object } response A response from a network request @return { Promise } Returns either the response or throws an error
function checkStatus(response) {
  return new Promise((resolve) => {
    if (response.status >= 200 && response.status < 300) {
      return resolve(response);
    }
    return parseJSON(response)
      .then((data) => {
        const error = new Error(data.message || response.statusText);
        error.data = data;
        error.response = response;
        throw error;
      });
  });
}
function checkStatus ( response ) { return new Promise ( ( resolve ) => { if ( response . status >= 200 && response . status < 300 ) { return resolve ( response ) ; } return parseJSON ( response ) . then ( ( data ) => { const error = new Error ( data . message || response . statusText ) ; error . data = data ; error . response = response ; throw error ; } ) ; } ) ; }
Checks if a network request came back fine, and throws an error if not
 @param  {object} response   A response from a network request
Checks if a network request came back fine and throws an error if not @param { object } response A response from a network request