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

safe-global / safe-cli / 9698327897

27 Jun 2024 02:20PM CUT coverage: 88.505%. Remained the same
9698327897

Pull #428

github

web-flow
Merge 50dd01ae7 into e829cd6e3
Pull Request #428: Add typer dependence

819 of 938 branches covered (87.31%)

Branch coverage included in aggregate %.

2815 of 3168 relevant lines covered (88.86%)

3.55 hits per line

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

91.18
/src/safe_cli/operators/hw_wallets/trezor_exceptions.py
1
import functools
4✔
2

3
from trezorlib.exceptions import (
4✔
4
    Cancelled,
5
    OutdatedFirmwareError,
6
    PinException,
7
    TrezorFailure,
8
)
9
from trezorlib.transport import TransportException
4✔
10

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

14

15
def raise_trezor_exception_as_hw_wallet_exception(function):
4✔
16
    @functools.wraps(function)
4✔
17
    def wrapper(*args, **kwargs):
4✔
18
        try:
4✔
19
            return function(*args, **kwargs)
4✔
20
        except TrezorFailure as e:
4✔
21
            raise HardwareWalletException(e.message)
×
22
        except OutdatedFirmwareError:
4✔
23
            raise HardwareWalletException("Trezor firmware version is not supported")
4✔
24
        except PinException:
4✔
25
            raise HardwareWalletException("Wrong PIN")
4✔
26
        except Cancelled:
4✔
27
            raise HardwareWalletException("Trezor operation was cancelled")
4✔
28
        except TransportException:
4✔
29
            raise HardwareWalletException("Trezor device is not connected")
4✔
30
        except InvalidDerivationPath as e:
×
31
            raise HardwareWalletException(e.message)
×
32

33
    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