How to use the @jupyterlab/services.ServerConnection.ResponseError function in @jupyterlab/services

To help you get started, we’ve selected a few @jupyterlab/services examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jtpio / jupyterlab-heroku / src / heroku.ts View on Github external
private async herokuAction(
    endpoint: string,
    method: string = "POST",
    data: Object = {}
  ): Promise {
    const path = this.getCurrentPath();
    const request = httpRequest(endpoint, method, {
      current_path: path,
      ...data
    });
    const response = await request;
    if (!response.ok) {
      const data = await response.json();
      throw new ServerConnection.ResponseError(response, data.message);
    }
    return response.json();
  }
github ryantam626 / jupyterlab_code_formatter / labextension / src / client.ts View on Github external
return response.text().then(data => {
          throw new ServerConnection.ResponseError(response, data);
        });
      }
github legion-platform / legion / legion / jupyterlab-plugin / src / api / cloud.ts View on Github external
async getPackagingIntegrations(
    credentials: ICloudCredentials
  ): Promise> {
    let response = await httpRequest(
      URLs.cloudPackagingIntegrationUrl,
      'GET',
      null,
      credentials
    );
    if (response.status !== 200) {
      const data = await response.json();
      throw new ServerConnection.ResponseError(response, data.message);
    }
    return response.json();
  }
github eWaterCycle / jupyterlab_thredds / src / browser.tsx View on Github external
return response.json().then((data) => {
                    throw new ServerConnection.ResponseError(response, data.message);
                });
            }
github legion-platform / legion / legion / jupyterlab-plugin / src / api / cloud.ts View on Github external
async removeCloudTraining(
    request: models.IRemoveRequest,
    credentials: ICloudCredentials
  ): Promise {
    let response = await httpRequest(
      URLs.cloudTrainingsUrl,
      'DELETE',
      request,
      credentials
    );
    if (response.status !== 200) {
      const data = await response.json();
      throw new ServerConnection.ResponseError(response, data.message);
    }
    return null;
  }
github jupyterlab / jupyterlab-google-drive / src / gapi.ts View on Github external
export function makeError(
  code: number,
  message: string
): ServerConnection.ResponseError {
  const response = new Response(message, { status: code, statusText: message });
  return new ServerConnection.ResponseError(response, message);
}
github legion-platform / legion / legion / jupyterlab-plugin / src / api / cloud.ts View on Github external
async getModelTrainings(
    credentials: ICloudCredentials
  ): Promise> {
    let response = await httpRequest(
      URLs.cloudTrainingsUrl,
      'GET',
      null,
      credentials
    );
    if (response.status !== 200) {
      const data = await response.json();
      throw new ServerConnection.ResponseError(response, data.message);
    }
    return response.json();
  }