How to use the @ledgerhq/errors.NetworkDown function in @ledgerhq/errors

To help you get started, we’ve selected a few @ledgerhq/errors 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 LedgerHQ / ledger-live-mobile / src / reducers / appstate.js View on Github external
};

const handlers: Object = {
  SYNC_IS_CONNECTED: (
    state: AppState,
    { isConnected }: { isConnected: boolean },
  ) => ({
    isConnected,
  }),
};

// Selectors

export const isConnectedSelector = (state: State) => state.appstate.isConnected;

const globalNetworkDown = new NetworkDown();

// $FlowFixMe
export const networkErrorSelector = createSelector(
  isConnectedSelector,
  isConnected => (!isConnected ? globalNetworkDown : null),
);

export default handleActions(handlers, initialState);
github LedgerHQ / ledger-live-common / src / families / ripple / bridge / js.js View on Github external
const remapError = error => {
  const msg = error.message;

  if (
    msg.includes("Unable to resolve host") ||
    msg.includes("Network is down")
  ) {
    return new NetworkDown();
  }

  return error;
};
github LedgerHQ / ledger-live-common / src / api / Manager.js View on Github external
async () => {
    const { data } = await network({
      method: "GET",
      url: URL.format({
        pathname: `${getEnv("MANAGER_API_BASE")}/applications`,
        query: { livecommonversion }
      })
    });
    if (!data || !Array.isArray(data)) {
      throw new NetworkDown("");
    }
    return data;
  },
  () => ""
github LedgerHQ / ledger-live-desktop / src / bridge / RippleJSBridge.js View on Github external
const remapError = error => {
  const msg = error.message

  if (msg.includes('Unable to resolve host') || msg.includes('Network is down')) {
    return new NetworkDown()
  }

  return error
}