Browse Source
More precise error messages on install/uninstall apps
master
meriadec
7 years ago
No known key found for this signature in database
GPG Key ID: 1D2FC2305E2CB399
3 changed files with
34 additions and
10 deletions
-
src/helpers/apps/installApp.js
-
src/helpers/apps/uninstallApp.js
-
static/i18n/en/errors.yml
|
|
@ -9,14 +9,26 @@ import type { LedgerScriptParams } from 'helpers/common' |
|
|
|
|
|
|
|
import createCustomErrorClass from '../createCustomErrorClass' |
|
|
|
|
|
|
|
const CannotInstall = createCustomErrorClass('CannotInstall') |
|
|
|
const ManagerUnexpectedError = createCustomErrorClass('ManagerUnexpected') |
|
|
|
const ManagerNotEnoughSpaceError = createCustomErrorClass('ManagerNotEnoughSpace') |
|
|
|
const ManagerDeviceLockedError = createCustomErrorClass('ManagerDeviceLocked') |
|
|
|
const ManagerAppAlreadyInstalledError = createCustomErrorClass('ManagerAppAlreadyInstalled') |
|
|
|
const ManagerAppRelyOnBTCError = createCustomErrorClass('ManagerAppRelyOnBTC') |
|
|
|
|
|
|
|
function remapError(promise) { |
|
|
|
return promise.catch((e: Error) => { |
|
|
|
if (e.message.endsWith('6982')) { |
|
|
|
throw new CannotInstall() |
|
|
|
switch (true) { |
|
|
|
case e.message.endsWith('6982'): |
|
|
|
throw new ManagerDeviceLockedError() |
|
|
|
case e.message.endsWith('6a84') || e.message.endsWith('6a85'): |
|
|
|
throw new ManagerNotEnoughSpaceError() |
|
|
|
case e.message.endsWith('6a80') || e.message.endsWith('6a81'): |
|
|
|
throw new ManagerAppAlreadyInstalledError() |
|
|
|
case e.message.endsWith('6a83'): |
|
|
|
throw new ManagerAppRelyOnBTCError() |
|
|
|
default: |
|
|
|
throw new ManagerUnexpectedError(e.message, { msg: e.message }) |
|
|
|
} |
|
|
|
throw e |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -8,14 +8,20 @@ import { createDeviceSocket } from 'helpers/socket' |
|
|
|
import type { LedgerScriptParams } from 'helpers/common' |
|
|
|
import createCustomErrorClass from '../createCustomErrorClass' |
|
|
|
|
|
|
|
const CannotUninstall = createCustomErrorClass('CannotUninstall') |
|
|
|
const ManagerUnexpectedError = createCustomErrorClass('ManagerUnexpectedError') |
|
|
|
const ManagerDeviceLockedError = createCustomErrorClass('ManagerDeviceLocked') |
|
|
|
const ManagerUninstallBTCDep = createCustomErrorClass('ManagerUninstallBTCDep') |
|
|
|
|
|
|
|
function remapError(promise) { |
|
|
|
return promise.catch((e: Error) => { |
|
|
|
if (e.message.endsWith('6a83')) { |
|
|
|
throw new CannotUninstall() |
|
|
|
switch (true) { |
|
|
|
case e.message.endsWith('6982'): |
|
|
|
throw new ManagerDeviceLockedError() |
|
|
|
case e.message.endsWith('6a83'): |
|
|
|
throw new ManagerUninstallBTCDep() |
|
|
|
default: |
|
|
|
throw new ManagerUnexpectedError(e.message, { msg: e.message }) |
|
|
|
} |
|
|
|
throw e |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -21,5 +21,11 @@ DeviceSocketNoBulkStatus: Oops, device connection failed. Please try again [bulk |
|
|
|
DeviceSocketNoHandler: Oops, device connection failed (handler {{query}}). Please try again. |
|
|
|
LatestMCUInstalledError: MCU on device already up to date. |
|
|
|
HardResetFail: Reset failed. Please try again. |
|
|
|
CannotUninstall: Cannot uninstall app. |
|
|
|
CannotInstall: Not enough room left on your device. Please uninstall some apps and try again. |
|
|
|
|
|
|
|
ManagerAPIsFail: Our services are currently unavailable. Please try again later. |
|
|
|
ManagerUnexpected: Unexpected error occurred ({{msg}}). Please try again later. |
|
|
|
ManagerNotEnoughSpace: Not enough room left on your device. Please uninstall some apps and try again. |
|
|
|
ManagerDeviceLocked: Device is locked |
|
|
|
ManagerAppAlreadyInstalled: App is already installed |
|
|
|
ManagerAppRelyOnBTC: You must install Bitcoin application first |
|
|
|
ManagerUninstallBTCDep: You must uninstall other altcoins first |
|
|
|