diff --git a/src/api/Ethereum.js b/src/api/Ethereum.js
index 68f72f90..12a01c6b 100644
--- a/src/api/Ethereum.js
+++ b/src/api/Ethereum.js
@@ -1,12 +1,10 @@
// @flow
import type { CryptoCurrency } from '@ledgerhq/live-common/lib/types'
import { BigNumber } from 'bignumber.js'
-import { createCustomErrorClass } from 'helpers/errors'
+import { LedgerAPINotAvailable } from 'config/errors'
import network from './network'
import { blockchainBaseURL } from './Ledger'
-export const LedgerAPINotAvailable = createCustomErrorClass('LedgerAPINotAvailable')
-
export type Block = { height: number } // TODO more fields actually
export type Tx = {
hash: string,
diff --git a/src/api/Fees.js b/src/api/Fees.js
index 19d32e77..fb380905 100644
--- a/src/api/Fees.js
+++ b/src/api/Fees.js
@@ -2,12 +2,10 @@
import invariant from 'invariant'
import LRU from 'lru-cache'
import type { Currency } from '@ledgerhq/live-common/lib/types'
-import { createCustomErrorClass } from 'helpers/errors'
+import { FeeEstimationFailed } from 'config/errors'
import { blockchainBaseURL } from './Ledger'
import network from './network'
-const FeeEstimationFailed = createCustomErrorClass('FeeEstimationFailed')
-
export type Fees = {
[_: string]: number,
}
diff --git a/src/api/network.js b/src/api/network.js
index 8743b401..eac84f7f 100644
--- a/src/api/network.js
+++ b/src/api/network.js
@@ -3,13 +3,9 @@ import axios from 'axios'
import { GET_CALLS_RETRY, GET_CALLS_TIMEOUT } from 'config/constants'
import { retry } from 'helpers/promise'
import logger from 'logger'
-import { createCustomErrorClass } from 'helpers/errors'
+import { LedgerAPIErrorWithMessage, LedgerAPIError, NetworkDown } from 'config/errors'
import anonymizer from 'helpers/anonymizer'
-export const LedgerAPIErrorWithMessage = createCustomErrorClass('LedgerAPIErrorWithMessage')
-export const LedgerAPIError = createCustomErrorClass('LedgerAPIError')
-export const NetworkDown = createCustomErrorClass('NetworkDown')
-
const userFriendlyError = (p: Promise, { url, method, startTime }): Promise =>
p.catch(error => {
let errorToThrow
diff --git a/src/bridge/EthereumJSBridge.js b/src/bridge/EthereumJSBridge.js
index 12dccc6e..b2aaabda 100644
--- a/src/bridge/EthereumJSBridge.js
+++ b/src/bridge/EthereumJSBridge.js
@@ -15,11 +15,9 @@ import { getDerivations } from 'helpers/derivations'
import getAddressCommand from 'commands/getAddress'
import signTransactionCommand from 'commands/signTransaction'
import { getAccountPlaceholderName, getNewAccountPlaceholderName } from 'helpers/accountName'
-import { createCustomErrorClass } from 'helpers/errors'
+import { NotEnoughBalance } from 'config/errors'
import type { EditProps, WalletBridge } from './types'
-const NotEnoughBalance = createCustomErrorClass('NotEnoughBalance')
-
// TODO in future it would be neat to support eip55
type Transaction = {
diff --git a/src/bridge/LibcoreBridge.js b/src/bridge/LibcoreBridge.js
index fd11f02e..d9638460 100644
--- a/src/bridge/LibcoreBridge.js
+++ b/src/bridge/LibcoreBridge.js
@@ -11,11 +11,10 @@ import libcoreSyncAccount from 'commands/libcoreSyncAccount'
import libcoreSignAndBroadcast from 'commands/libcoreSignAndBroadcast'
import libcoreGetFees from 'commands/libcoreGetFees'
import libcoreValidAddress from 'commands/libcoreValidAddress'
-import { createCustomErrorClass } from 'helpers/errors'
+import { NotEnoughBalance } from 'config/errors'
import type { WalletBridge, EditProps } from './types'
const NOT_ENOUGH_FUNDS = 52
-const NotEnoughBalance = createCustomErrorClass('NotEnoughBalance')
const notImplemented = new Error('LibcoreBridge: not implemented')
diff --git a/src/bridge/RippleJSBridge.js b/src/bridge/RippleJSBridge.js
index a201b621..e12655a5 100644
--- a/src/bridge/RippleJSBridge.js
+++ b/src/bridge/RippleJSBridge.js
@@ -20,11 +20,9 @@ import {
import FeesRippleKind from 'components/FeesField/RippleKind'
import AdvancedOptionsRippleKind from 'components/AdvancedOptions/RippleKind'
import { getAccountPlaceholderName, getNewAccountPlaceholderName } from 'helpers/accountName'
-import { createCustomErrorClass } from 'helpers/errors'
+import { NotEnoughBalance } from 'config/errors'
import type { WalletBridge, EditProps } from './types'
-const NotEnoughBalance = createCustomErrorClass('NotEnoughBalance')
-
type Transaction = {
amount: BigNumber,
recipient: string,
diff --git a/src/commands/libcoreGetFees.js b/src/commands/libcoreGetFees.js
index e6d5a005..ab96ff30 100644
--- a/src/commands/libcoreGetFees.js
+++ b/src/commands/libcoreGetFees.js
@@ -6,9 +6,7 @@ import withLibcore from 'helpers/withLibcore'
import { createCommand, Command } from 'helpers/ipc'
import * as accountIdHelper from 'helpers/accountId'
import { isValidAddress, libcoreAmountToBigNumber, bigNumberToLibcoreAmount } from 'helpers/libcore'
-import { createCustomErrorClass } from 'helpers/errors'
-
-const InvalidAddress = createCustomErrorClass('InvalidAddress')
+import { InvalidAddress } from 'config/errors'
type BitcoinLikeTransaction = {
// TODO we rename this Transaction concept into transactionInput
diff --git a/src/commands/libcoreHardReset.js b/src/commands/libcoreHardReset.js
index 6b52a6a9..fa06e17d 100644
--- a/src/commands/libcoreHardReset.js
+++ b/src/commands/libcoreHardReset.js
@@ -3,9 +3,7 @@
import { createCommand } from 'helpers/ipc'
import { fromPromise } from 'rxjs/observable/fromPromise'
import withLibcore from 'helpers/withLibcore'
-import { createCustomErrorClass } from 'helpers/errors'
-
-const HardResetFail = createCustomErrorClass('HardResetFail')
+import { HardResetFail } from 'config/errors'
const cmd = createCommand('libcoreHardReset', () =>
fromPromise(
diff --git a/src/components/EnsureDeviceApp.js b/src/components/EnsureDeviceApp.js
index 4748a0a9..6bb0e89c 100644
--- a/src/components/EnsureDeviceApp.js
+++ b/src/components/EnsureDeviceApp.js
@@ -12,7 +12,6 @@ import getAddress from 'commands/getAddress'
import { createCancelablePolling } from 'helpers/promise'
import { standardDerivation } from 'helpers/derivations'
import { isSegwitPath } from 'helpers/bip32'
-import { BtcUnmatchedApp } from 'helpers/getAddressForCurrency/btc'
import DeviceInteraction from 'components/DeviceInteraction'
import Text from 'components/base/Text'
@@ -21,7 +20,7 @@ import IconUsb from 'icons/Usb'
import type { Device } from 'types/common'
-import { WrongDeviceForAccount, CantOpenDevice } from 'config/errors'
+import { WrongDeviceForAccount, CantOpenDevice, BtcUnmatchedApp } from 'config/errors'
import { getCurrentDevice } from 'reducers/devices'
const usbIcon =
diff --git a/src/components/IsUnlocked.js b/src/components/IsUnlocked.js
index ecd90d79..381edfff 100644
--- a/src/components/IsUnlocked.js
+++ b/src/components/IsUnlocked.js
@@ -17,7 +17,7 @@ import hardReset from 'helpers/hardReset'
import { fetchAccounts } from 'actions/accounts'
import { isLocked, unlock } from 'reducers/application'
-import { createCustomErrorClass } from 'helpers/errors'
+import { PasswordIncorrectError } from 'config/errors'
import Box from 'components/base/Box'
import InputPassword from 'components/base/InputPassword'
@@ -26,8 +26,6 @@ import IconArrowRight from 'icons/ArrowRight'
import Button from './base/Button/index'
import ConfirmModal from './base/Modal/ConfirmModal'
-const PasswordIncorrectError = createCustomErrorClass('PasswordIncorrect')
-
type InputValue = {
password: string,
}
diff --git a/src/components/SettingsPage/DisablePasswordModal.js b/src/components/SettingsPage/DisablePasswordModal.js
index bd177544..17b9a0fa 100644
--- a/src/components/SettingsPage/DisablePasswordModal.js
+++ b/src/components/SettingsPage/DisablePasswordModal.js
@@ -1,7 +1,7 @@
// @flow
import React, { PureComponent } from 'react'
-import { createCustomErrorClass } from 'helpers/errors'
+import { PasswordIncorrectError } from 'config/errors'
import db from 'helpers/db'
import Box from 'components/base/Box'
@@ -12,8 +12,6 @@ import { Modal, ModalContent, ModalBody, ModalTitle, ModalFooter } from 'compone
import type { T } from 'types/common'
-const PasswordIncorrectError = createCustomErrorClass('PasswordIncorrect')
-
type Props = {
t: T,
onClose: Function,
diff --git a/src/components/SettingsPage/PasswordForm.js b/src/components/SettingsPage/PasswordForm.js
index 6f03c6bd..b523fd2e 100644
--- a/src/components/SettingsPage/PasswordForm.js
+++ b/src/components/SettingsPage/PasswordForm.js
@@ -6,12 +6,10 @@ import Box from 'components/base/Box'
import InputPassword from 'components/base/InputPassword'
import Label from 'components/base/Label'
-import { createCustomErrorClass } from 'helpers/errors'
+import { PasswordsDontMatchError } from 'config/errors'
import type { T } from 'types/common'
-const PasswordsDontMatchError = createCustomErrorClass('PasswordsDontMatch')
-
type Props = {
t: T,
hasPassword: boolean,
diff --git a/src/components/SettingsPage/PasswordModal.js b/src/components/SettingsPage/PasswordModal.js
index a364ebce..596d2398 100644
--- a/src/components/SettingsPage/PasswordModal.js
+++ b/src/components/SettingsPage/PasswordModal.js
@@ -5,15 +5,13 @@ import React, { PureComponent } from 'react'
import type { T } from 'types/common'
import db from 'helpers/db'
-import { createCustomErrorClass } from 'helpers/errors'
+import { PasswordIncorrectError } from 'config/errors'
import Box from 'components/base/Box'
import Button from 'components/base/Button'
import { Modal, ModalContent, ModalBody, ModalTitle, ModalFooter } from 'components/base/Modal'
import PasswordForm from './PasswordForm'
-const PasswordIncorrectError = createCustomErrorClass('PasswordIncorrect')
-
type Props = {
t: T,
onClose: () => void,
diff --git a/src/components/modals/AccountSettingRenderBody.js b/src/components/modals/AccountSettingRenderBody.js
index 2ec155ab..86594ced 100644
--- a/src/components/modals/AccountSettingRenderBody.js
+++ b/src/components/modals/AccountSettingRenderBody.js
@@ -17,7 +17,7 @@ import { setDataModal } from 'reducers/modals'
import { getBridgeForCurrency } from 'bridge'
-import { createCustomErrorClass } from 'helpers/errors'
+import { AccountNameRequiredError, EnpointConfigError } from 'config/errors'
import TrackPage from 'analytics/TrackPage'
import Spoiler from 'components/base/Spoiler'
@@ -36,9 +36,6 @@ import {
ConfirmModal,
} from 'components/base/Modal'
-const AccountNameRequiredError = createCustomErrorClass('AccountNameRequired')
-const EnpointConfigError = createCustomErrorClass('EnpointConfig')
-
type State = {
accountName: ?string,
accountUnit: ?Unit,
diff --git a/src/components/modals/Send/fields/RecipientField.js b/src/components/modals/Send/fields/RecipientField.js
index 67c69e60..a8be45ba 100644
--- a/src/components/modals/Send/fields/RecipientField.js
+++ b/src/components/modals/Send/fields/RecipientField.js
@@ -9,7 +9,7 @@ import Box from 'components/base/Box'
import LabelWithExternalIcon from 'components/base/LabelWithExternalIcon'
import RecipientAddress from 'components/RecipientAddress'
import { track } from 'analytics/segment'
-import { createCustomErrorClass } from 'helpers/errors'
+import { InvalidAddress } from 'config/errors'
type Props = {
t: T,
@@ -20,8 +20,6 @@ type Props = {
autoFocus?: boolean,
}
-const InvalidAddress = createCustomErrorClass('InvalidAddress')
-
class RecipientField extends Component, { isValid: boolean }> {
state = {
isValid: true,
diff --git a/src/config/errors.js b/src/config/errors.js
index d6140d6c..069389b8 100644
--- a/src/config/errors.js
+++ b/src/config/errors.js
@@ -4,15 +4,41 @@
import { createCustomErrorClass } from 'helpers/errors'
-export const DisconnectedDevice = createCustomErrorClass('DisconnectedDevice')
-export const UserRefusedOnDevice = createCustomErrorClass('UserRefusedOnDevice') // TODO rename because it's just for transaction refusal
+export const AccountNameRequiredError = createCustomErrorClass('AccountNameRequired')
+export const BtcUnmatchedApp = createCustomErrorClass('BtcUnmatchedApp')
export const CantOpenDevice = createCustomErrorClass('CantOpenDevice')
export const DeviceAppVerifyNotSupported = createCustomErrorClass('DeviceAppVerifyNotSupported')
-export const UserRefusedAddress = createCustomErrorClass('UserRefusedAddress')
-export const WrongDeviceForAccount = createCustomErrorClass('WrongDeviceForAccount')
-export const DeviceNotGenuineError = createCustomErrorClass('DeviceNotGenuine')
export const DeviceGenuineSocketEarlyClose = createCustomErrorClass('DeviceGenuineSocketEarlyClose')
+export const DeviceNotGenuineError = createCustomErrorClass('DeviceNotGenuine')
+export const DeviceSocketFail = createCustomErrorClass('DeviceSocketFail')
+export const DeviceSocketNoBulkStatus = createCustomErrorClass('DeviceSocketNoBulkStatus')
+export const DeviceSocketNoHandler = createCustomErrorClass('DeviceSocketNoHandler')
+export const DisconnectedDevice = createCustomErrorClass('DisconnectedDevice')
+export const EnpointConfigError = createCustomErrorClass('EnpointConfig')
+export const FeeEstimationFailed = createCustomErrorClass('FeeEstimationFailed')
+export const HardResetFail = createCustomErrorClass('HardResetFail')
+export const InvalidAddress = createCustomErrorClass('InvalidAddress')
+export const LatestMCUInstalledError = createCustomErrorClass('LatestMCUInstalledError')
+export const LedgerAPIError = createCustomErrorClass('LedgerAPIError')
+export const LedgerAPIErrorWithMessage = createCustomErrorClass('LedgerAPIErrorWithMessage')
+export const LedgerAPINotAvailable = createCustomErrorClass('LedgerAPINotAvailable')
+export const ManagerAppAlreadyInstalledError = createCustomErrorClass('ManagerAppAlreadyInstalled')
+export const ManagerAppRelyOnBTCError = createCustomErrorClass('ManagerAppRelyOnBTC')
+export const ManagerDeviceLockedError = createCustomErrorClass('ManagerDeviceLocked')
+export const ManagerNotEnoughSpaceError = createCustomErrorClass('ManagerNotEnoughSpace')
+export const ManagerUninstallBTCDep = createCustomErrorClass('ManagerUninstallBTCDep')
+export const NetworkDown = createCustomErrorClass('NetworkDown')
+export const NoAddressesFound = createCustomErrorClass('NoAddressesFound')
+export const NotEnoughBalance = createCustomErrorClass('NotEnoughBalance')
+export const PasswordsDontMatchError = createCustomErrorClass('PasswordsDontMatch')
+export const PasswordIncorrectError = createCustomErrorClass('PasswordIncorrect')
export const TimeoutTagged = createCustomErrorClass('TimeoutTagged')
+export const UserRefusedAddress = createCustomErrorClass('UserRefusedAddress')
+export const UserRefusedFirmwareUpdate = createCustomErrorClass('UserRefusedFirmwareUpdate')
+export const UserRefusedOnDevice = createCustomErrorClass('UserRefusedOnDevice') // TODO rename because it's just for transaction refusal
+export const WebsocketConnectionError = createCustomErrorClass('WebsocketConnectionError')
+export const WebsocketConnectionFailed = createCustomErrorClass('WebsocketConnectionFailed')
+export const WrongDeviceForAccount = createCustomErrorClass('WrongDeviceForAccount')
// db stuff, no need to translate
export const NoDBPathGiven = createCustomErrorClass('NoDBPathGiven')
diff --git a/src/helpers/apps/installApp.js b/src/helpers/apps/installApp.js
index ce45f797..875890bc 100644
--- a/src/helpers/apps/installApp.js
+++ b/src/helpers/apps/installApp.js
@@ -4,14 +4,14 @@ import type Transport from '@ledgerhq/hw-transport'
import { createDeviceSocket } from 'helpers/socket'
import type { ApplicationVersion } from 'helpers/types'
-
-import { createCustomErrorClass } from 'helpers/errors'
import { WS_INSTALL } from 'helpers/urls'
-const ManagerNotEnoughSpaceError = createCustomErrorClass('ManagerNotEnoughSpace')
-const ManagerDeviceLockedError = createCustomErrorClass('ManagerDeviceLocked')
-const ManagerAppAlreadyInstalledError = createCustomErrorClass('ManagerAppAlreadyInstalled')
-const ManagerAppRelyOnBTCError = createCustomErrorClass('ManagerAppRelyOnBTC')
+import {
+ ManagerNotEnoughSpaceError,
+ ManagerDeviceLockedError,
+ ManagerAppAlreadyInstalledError,
+ ManagerAppRelyOnBTCError,
+} from 'config/errors'
function remapError(promise) {
return promise.catch((e: Error) => {
diff --git a/src/helpers/apps/uninstallApp.js b/src/helpers/apps/uninstallApp.js
index 7ce6fef3..b3c2b98b 100644
--- a/src/helpers/apps/uninstallApp.js
+++ b/src/helpers/apps/uninstallApp.js
@@ -4,12 +4,9 @@ import type Transport from '@ledgerhq/hw-transport'
import { createDeviceSocket } from 'helpers/socket'
import type { ApplicationVersion } from 'helpers/types'
-import { createCustomErrorClass } from 'helpers/errors'
+import { ManagerDeviceLockedError, ManagerUninstallBTCDep } from 'config/errors'
import { WS_INSTALL } from 'helpers/urls'
-const ManagerDeviceLockedError = createCustomErrorClass('ManagerDeviceLocked')
-const ManagerUninstallBTCDep = createCustomErrorClass('ManagerUninstallBTCDep')
-
function remapError(promise) {
return promise.catch((e: Error) => {
switch (true) {
diff --git a/src/helpers/debugAppInfosForCurrency/btc.js b/src/helpers/debugAppInfosForCurrency/btc.js
index b7375e7c..74e7460a 100644
--- a/src/helpers/debugAppInfosForCurrency/btc.js
+++ b/src/helpers/debugAppInfosForCurrency/btc.js
@@ -1,9 +1,6 @@
// @flow
import type Transport from '@ledgerhq/hw-transport'
-import { createCustomErrorClass } from '../errors'
-
-export const BtcUnmatchedApp = createCustomErrorClass('BtcUnmatchedApp')
export default async (transport: Transport<*>) => {
const r = await transport.send(0xe0, 0xc4, 0, 0)
diff --git a/src/helpers/firmware/getNextMCU.js b/src/helpers/firmware/getNextMCU.js
index 3ab9337f..fcb82cd7 100644
--- a/src/helpers/firmware/getNextMCU.js
+++ b/src/helpers/firmware/getNextMCU.js
@@ -2,10 +2,8 @@
import network from 'api/network'
import { GET_NEXT_MCU } from 'helpers/urls'
-import { createCustomErrorClass } from 'helpers/errors'
import type { OsuFirmware } from 'helpers/types'
-
-const LatestMCUInstalledError = createCustomErrorClass('LatestMCUInstalledError')
+import { LatestMCUInstalledError } from 'config/errors'
type NetworkResponse = { data: OsuFirmware | 'default' }
diff --git a/src/helpers/firmware/installFinalFirmware.js b/src/helpers/firmware/installFinalFirmware.js
index be13f6c1..7857ffb8 100644
--- a/src/helpers/firmware/installFinalFirmware.js
+++ b/src/helpers/firmware/installFinalFirmware.js
@@ -4,13 +4,12 @@ import type { DeviceInfo, DeviceVersion, OsuFirmware, FinalFirmware } from 'help
import { WS_INSTALL } from 'helpers/urls'
import { createDeviceSocket } from 'helpers/socket'
-import { createCustomErrorClass } from 'helpers/errors'
import getDeviceVersion from 'helpers/devices/getDeviceVersion'
import getOsuFirmware from 'helpers/devices/getOsuFirmware'
import getDeviceInfo from 'helpers/devices/getDeviceInfo'
-import getFinalFirmwareById from './getFinalFirmwareById'
+import { ManagerDeviceLockedError } from 'config/errors'
-const ManagerDeviceLockedError = createCustomErrorClass('ManagerDeviceLocked')
+import getFinalFirmwareById from './getFinalFirmwareById'
function remapSocketError(promise) {
return promise.catch((e: Error) => {
diff --git a/src/helpers/firmware/installMcu.js b/src/helpers/firmware/installMcu.js
index d0ffb39e..18cd4872 100644
--- a/src/helpers/firmware/installMcu.js
+++ b/src/helpers/firmware/installMcu.js
@@ -5,12 +5,10 @@ import { WS_MCU } from 'helpers/urls'
import { createDeviceSocket } from 'helpers/socket'
import getNextMCU from 'helpers/firmware/getNextMCU'
import getDeviceInfo from 'helpers/devices/getDeviceInfo'
-import { createCustomErrorClass } from 'helpers/errors'
+import { ManagerDeviceLockedError } from 'config/errors'
import type { DeviceInfo } from 'helpers/types'
-const ManagerDeviceLockedError = createCustomErrorClass('ManagerDeviceLocked')
-
function remapSocketError(promise) {
return promise.catch((e: Error) => {
switch (true) {
diff --git a/src/helpers/firmware/installOsuFirmware.js b/src/helpers/firmware/installOsuFirmware.js
index 1121c340..04a9ba33 100644
--- a/src/helpers/firmware/installOsuFirmware.js
+++ b/src/helpers/firmware/installOsuFirmware.js
@@ -6,11 +6,11 @@ import { createDeviceSocket } from 'helpers/socket'
import type { Firmware } from 'components/modals/UpdateFirmware'
-import { createCustomErrorClass } from '../errors'
-
-const ManagerNotEnoughSpaceError = createCustomErrorClass('ManagerNotEnoughSpace')
-const ManagerDeviceLockedError = createCustomErrorClass('ManagerDeviceLocked')
-const UserRefusedFirmwareUpdate = createCustomErrorClass('UserRefusedFirmwareUpdate')
+import {
+ ManagerNotEnoughSpaceError,
+ ManagerDeviceLockedError,
+ UserRefusedFirmwareUpdate,
+} from 'config/errors'
function remapError(promise) {
return promise.catch((e: Error) => {
diff --git a/src/helpers/getAddressForCurrency/btc.js b/src/helpers/getAddressForCurrency/btc.js
index f0ed669a..8155a25d 100644
--- a/src/helpers/getAddressForCurrency/btc.js
+++ b/src/helpers/getAddressForCurrency/btc.js
@@ -3,10 +3,8 @@
import type { CryptoCurrency } from '@ledgerhq/live-common/lib/types'
import Btc from '@ledgerhq/hw-app-btc'
import type Transport from '@ledgerhq/hw-transport'
+import { BtcUnmatchedApp } from 'config/errors'
import getBitcoinLikeInfo from '../devices/getBitcoinLikeInfo'
-import { createCustomErrorClass } from '../errors'
-
-export const BtcUnmatchedApp = createCustomErrorClass('BtcUnmatchedApp')
export default async (
transport: Transport<*>,
diff --git a/src/helpers/libcore.js b/src/helpers/libcore.js
index 630c0c14..4f3a39c1 100644
--- a/src/helpers/libcore.js
+++ b/src/helpers/libcore.js
@@ -14,12 +14,11 @@ import type { NJSAccount, NJSOperation } from '@ledgerhq/ledger-core/src/ledgerc
import { isSegwitPath, isUnsplitPath } from 'helpers/bip32'
import * as accountIdHelper from 'helpers/accountId'
-import { createCustomErrorClass, deserializeError } from './errors'
+import { NoAddressesFound } from 'config/errors'
+import { deserializeError } from './errors'
import { getAccountPlaceholderName, getNewAccountPlaceholderName } from './accountName'
import { timeoutTagged } from './promise'
-const NoAddressesFound = createCustomErrorClass('NoAddressesFound')
-
// TODO: put that info inside currency itself
const SPLITTED_CURRENCIES = {
bitcoin_cash: {
diff --git a/src/helpers/socket.js b/src/helpers/socket.js
index 5611a3a5..cf9d29a8 100644
--- a/src/helpers/socket.js
+++ b/src/helpers/socket.js
@@ -5,13 +5,13 @@ import logger from 'logger'
import Websocket from 'ws'
import type Transport from '@ledgerhq/hw-transport'
import { Observable } from 'rxjs'
-import { createCustomErrorClass } from './errors'
-
-const WebsocketConnectionError = createCustomErrorClass('WebsocketConnectionError')
-const WebsocketConnectionFailed = createCustomErrorClass('WebsocketConnectionFailed')
-const DeviceSocketFail = createCustomErrorClass('DeviceSocketFail')
-const DeviceSocketNoBulkStatus = createCustomErrorClass('DeviceSocketNoBulkStatus')
-const DeviceSocketNoHandler = createCustomErrorClass('DeviceSocketNoHandler')
+import {
+ WebsocketConnectionError,
+ WebsocketConnectionFailed,
+ DeviceSocketFail,
+ DeviceSocketNoBulkStatus,
+ DeviceSocketNoHandler,
+} from 'config/errors'
/**
* use Ledger WebSocket API to exchange data with the device