• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

safe-global / safe-cli / 8157330034

05 Mar 2024 01:47PM UTC coverage: 95.161%. Remained the same
8157330034

push

github

Uxio0
Rename `master` -> `main`

2163 of 2273 relevant lines covered (95.16%)

3.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.83
/safe_cli/operators/hw_wallets/ledger_exceptions.py
1
import functools
4✔
2

3
from ledgereth.exceptions import (
4✔
4
    LedgerAppNotOpened,
5
    LedgerCancel,
6
    LedgerLocked,
7
    LedgerNotFound,
8
)
9

10
from ..exceptions import HardwareWalletException
4✔
11
from .exceptions import InvalidDerivationPath
4✔
12

13

14
def raise_ledger_exception_as_hw_wallet_exception(function):
4✔
15
    @functools.wraps(function)
4✔
16
    def wrapper(*args, **kwargs):
4✔
17
        try:
4✔
18
            return function(*args, **kwargs)
4✔
19
        except LedgerNotFound as e:
4✔
20
            raise HardwareWalletException(e.message)
4✔
21
        except LedgerLocked as e:
4✔
22
            raise HardwareWalletException(e.message)
4✔
23
        except LedgerAppNotOpened as e:
4✔
24
            raise HardwareWalletException(e.message)
4✔
25
        except LedgerCancel as e:
4✔
26
            raise HardwareWalletException(e.message)
4✔
27
        except InvalidDerivationPath as e:
4✔
28
            raise HardwareWalletException(e.message)
4✔
29
        except BaseException as e:
4✔
30
            if "Error while writing" in e.args:
4✔
31
                raise HardwareWalletException("Ledger error writting, restart safe-cli")
×
32
            raise e
4✔
33

34
    return wrapper
4✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc