You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error message for mnemonic_sentence and mnemonic_second_factor need to be improved:
E.g. when doing POST v2\wallets and providing invalid mnemonic sentence or valid mnemonic sentence but with invalid length to one of the parameters the following error is returned:
Error in $['mnemonic_sentence']: ErrMnemonicWords (ErrWrongNumberOfWords 12 24)
the error is not really human friendly and can be misleading
it is faultly thrown for the case when the number of words is valid but mnemonics are invalid
it is faulty thrown for the non-english mnemonics (ErrMnemonicWords (ErrWrongNumberOfWords instead of ErrDictionary (ErrInvalidDictionaryWord)
Steps to Reproduce
Please note that examples are for mnemonic_sentence but the same situation adheres to mnemonic_second_factor.
Case 1 - invalid mnemonics, valid length
The error should be rather something like: Error in $['mnemonic_sentence']: The list of provided mnemonic words is invalid.
Case 2 - valid mnemonics, invalid length
The error should be rather something like: Error in $['mnemonic_sentence']: The list of provided mnemonic is too short (9). Supported lengths are 15,18,21,24.
Case 3 - valid, yet non-english mnemonics Error in $['mnemonic_sentence']: Non-english mnemonic words are not supported
Actual behavior
Case 1 - invalid mnemonics, valid length
The error message returned for the case is: Error in $['mnemonic_sentence']: ErrMnemonicWords (ErrWrongNumberOfWords 15 24)
Case 2 - valid mnemonics, invalid length
The error message returned for the case is: Error in $['mnemonic_sentence']: ErrMnemonicWords (ErrWrongNumberOfWords 9 24)
Case 3 - valid, yet non-english mnemonics
Actually the same error is returned -> Error in $['mnemonic_sentence']: ErrMnemonicWords (ErrWrongNumberOfWords 9 24) instead of expected ErrDictionary (ErrInvalidDictionaryWord .... However even the ErrDictionary (ErrInvalidDictionaryWord ... should be polished to be informative and user-friendly as indicated in Expected behavior.
Resolution Plan
The FromMnemonic class used to parse a list of mnemonic words of variable length seems to only report the last error encountered in the list.
Introducing some failing test case to illustrate this hypothesis and then, if confirmed, fixing it it the way to go.
Context
Error message for
mnemonic_sentence
andmnemonic_second_factor
need to be improved:E.g. when doing
POST v2\wallets
and providing invalid mnemonic sentence or valid mnemonic sentence but with invalid length to one of the parameters the following error is returned:Error in $['mnemonic_sentence']: ErrMnemonicWords (ErrWrongNumberOfWords 12 24)
ErrMnemonicWords (ErrWrongNumberOfWords
instead ofErrDictionary (ErrInvalidDictionaryWord
)Steps to Reproduce
Please note that examples are for
mnemonic_sentence
but the same situation adheres tomnemonic_second_factor
.Case 1 - invalid mnemonics, valid length
Case 2 - valid mnemonics, invalid length
Case 3 - valid, yet non-english mnemonics
Expected behavior
Case 1 - invalid mnemonics, valid length
The error should be rather something like:
Error in $['mnemonic_sentence']: The list of provided mnemonic words is invalid.
Case 2 - valid mnemonics, invalid length
The error should be rather something like:
Error in $['mnemonic_sentence']: The list of provided mnemonic is too short (9). Supported lengths are 15,18,21,24.
Case 3 - valid, yet non-english mnemonics
Error in $['mnemonic_sentence']: Non-english mnemonic words are not supported
Actual behavior
Case 1 - invalid mnemonics, valid length
The error message returned for the case is:
Error in $['mnemonic_sentence']: ErrMnemonicWords (ErrWrongNumberOfWords 15 24)
Case 2 - valid mnemonics, invalid length
The error message returned for the case is:
Error in $['mnemonic_sentence']: ErrMnemonicWords (ErrWrongNumberOfWords 9 24)
Case 3 - valid, yet non-english mnemonics
Actually the same error is returned ->
Error in $['mnemonic_sentence']: ErrMnemonicWords (ErrWrongNumberOfWords 9 24)
instead of expectedErrDictionary (ErrInvalidDictionaryWord ...
. However even theErrDictionary (ErrInvalidDictionaryWord ...
should be polished to be informative and user-friendly as indicated in Expected behavior.Resolution Plan
FromMnemonic
class used to parse a list of mnemonic words of variable length seems to only report the last error encountered in the list.PR
master
QA
The text was updated successfully, but these errors were encountered: