How to use the getstream.errors function in getstream

To help you get started, we’ve selected a few getstream 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 GetStream / react-activity-feed / src / errors.js View on Github external
export const getErrorMessage = (
  error: Error,
  type: FlowRequestTypes,
  detail: Object,
): string => {
  console.warn(error);
  if (!(error instanceof stream.errors.StreamApiError)) {
    return fallbackErrorMessage(error, type, detail);
  }
  const response = error.response;

  if (!response.statusCode || !response.body || !response.body.detail) {
    return fallbackErrorMessage(error, type, detail);
  }
  const statusCode = response.statusCode;
  const text = response.body.detail;

  /* eslint-disable no-magic-numbers */
  if (statusCode >= 400 && statusCode < 600) {
    return text;
  }
  /* eslint-enable no-magic-numbers */
github GetStream / react-native-activity-feed / src / errors.js View on Github external
export const getErrorMessage = (
  error: Error,
  type: FlowRequestTypes,
  detail: Object,
): string => {
  console.warn(error);
  if (!(error instanceof stream.errors.StreamApiError)) {
    return fallbackErrorMessage(error, type, detail);
  }
  const response = error.response;

  if (!response.statusCode || !response.body || !response.body.detail) {
    return fallbackErrorMessage(error, type, detail);
  }
  const statusCode = response.statusCode;
  const text = response.body.detail;

  if (statusCode >= 400 && statusCode < 500) {
    return text;
  } else if (statusCode >= 500 && statusCode < 600) {
    return text;
  }
github GetStream / react-native-activity-feed / example / scripts / initData.js View on Github external
async function ignore409(asyncfn) {
  try {
    await asyncfn();
  } catch (e) {
    if (
      !(e instanceof stream.errors.StreamApiError) ||
      e.response.statusCode != 409
    ) {
      throw e;
    }
  }
}
github GetStream / react-native-example / scripts / initData.js View on Github external
async function ignore409(asyncfn) {
  try {
    await asyncfn();
  } catch (e) {
    if (
      !(e instanceof stream.errors.StreamApiError) ||
      e.response.statusCode != 409
    ) {
      throw e;
    }
  }
}

getstream

The official low-level GetStream.io client for Node.js and the browser.

BSD-3-Clause
Latest version published 3 months ago

Package Health Score

84 / 100
Full package analysis