SubstrateBip39Exception.fromException constructor

SubstrateBip39Exception.fromException(
  1. Exception e
)

Implementation

factory SubstrateBip39Exception.fromException(Exception e) {
  final message = e.toString();
  if (message.contains('mnemonic: unexpected sentence length')) {
    return SubstrateBip39Exception.invalidSeedLength();
  } else if (message.contains('does not exist in english')) {
    return SubstrateBip39Exception.invalidPhrase();
  } else if (message.contains('mnemonic: invalid checksum')) {
    return SubstrateBip39Exception.invalidSeed();
  }
  return SubstrateBip39Exception.invalidFormat(message);
}