How to use get_error method in autotest

Best Python code snippet using autotest_python

error_code.py

Source:error_code.py Github

copy

Full Screen

...345class ErrorCode:6 @staticmethod7 def get_error(code: int, msg: str) -> dict:8 data = dict()9 data['error'] = code10 data['desc'] = msg11 return data1213 @staticmethod14 def unpack_error(msg: str) -> dict:15 return ErrorCode.get_error(10001, f'Binary Reader Error, {msg}')1617 @staticmethod18 def read_byte_error(msg: str) -> dict:19 return ErrorCode.get_error(10002, f'Binary Reader Error, {msg}')2021 @staticmethod22 def params_type_error(msg: str) -> dict:23 return ErrorCode.get_error(20000, 'Interface Error, ' + msg)2425 require_bool_params = get_error.__func__(20001, 'Interface Error, the type of parameter should be int.')26 require_int_params = get_error.__func__(20002, 'Interface Error, the type of parameter should be int.')27 require_float_params = get_error.__func__(20003, 'Interface Error, the type of parameter should be float.')28 require_str_params = get_error.__func__(20004, 'Interface Error, the type of parameter should be str.')29 require_bytes_params = get_error.__func__(20005, 'Interface Error, the type of parameter should be bytes.')30 require_list_params = get_error.__func__(20006, 'Interface Error, the type of parameter should be list.')31 require_tuple_params = get_error.__func__(20007, 'Interface Error, the type of parameter should be tuple.')32 require_set_params = get_error.__func__(20008, 'Interface Error, the type of parameter should be set.')33 require_dict_params = get_error.__func__(20009, 'Interface Error, the type of parameter should be dict.')34 require_control_params = get_error.__func__(20010, 'Interface Error, a Control object is required.')35 require_acct_params = get_error.__func__(20011, 'Interface Error, a Account object is required.')3637 invalid_b64_claim_data = get_error.__func__(21001, 'Interface Error, invalid base64 encode claim.')38 invalid_blk_proof = get_error.__func__(21002, 'Interface Error, invalid blockchain proof.')39 invalid_merkle_root = get_error.__func__(21003, 'Interface Error, invalid merkle root.')40 invalid_claim_type = get_error.__func__(21004, 'Interface Error, invalid claim type.')41 invalid_claim_alg = get_error.__func__(21004, 'Interface Error, invalid claim algorithm.')42 invalid_claim_head_params = get_error.__func__(21005, 'Interface Error, invalid claim head parameter.')4344 @staticmethod45 def invalid_ont_id_format(ont_id: str):46 return ErrorCode.get_error(30001, f'Identity Error, invalid OntId: {ont_id}')4748 invalid_ont_id_type = get_error.__func__(30002, 'Identity Error, invalid type of OntId')4950 @staticmethod51 def invalid_wallet_path(path: str):52 return ErrorCode.get_error(40001, f'WalletManager Error, invalid path: {path}')5354 @staticmethod55 def invalid_contract_address(contract_address: str):56 return ErrorCode.get_error(50001, f'NeoVm Error, invalid hex contract address: {contract_address}')5758 invalid_private_key = get_error.__func__(100001, 'Account Error, invalid private key.')59 unsupported_key_type = get_error.__func__(100002, 'Account Error, unsupported key type.')6061 invalid_message = get_error.__func__(100003, "Account Error, invalid message")62 without_private = get_error.__func__(100004, "Account Error, account without private key cannot generate signature")63 invalid_sm2_signature = get_error.__func__(100005,64 "Account Error, invalid SM2 signature parameter, ID (String) excepted")65 account_invalid_input = get_error.__func__(100006, "Account Error, account invalid input")66 account_without_public_key = get_error.__func__(100007,67 "Account Error, account without public key cannot verify signature")68 null_input = get_error.__func__(100009, "Account Error, null input")69 invalid_data = get_error.__func__(100010, "Account Error, invalid data")70 decoded_3bytes_error = get_error.__func__(100011, "Account Error, decoded 3 bytes error")71 decode_pri_key_passphrase_error = get_error.__func__(100012, "Account Error, decode prikey passphrase error.")72 pri_key_length_error = get_error.__func__(100013, "Account Error, Prikey length error")73 encrypted_pri_key_error = get_error.__func__(100014, "Account Error, Prikey length error")74 encrypted_pri_key_address_password_err = get_error.__func__(100015,75 "Account Error, encrypted private key address password not match.")76 encrypt_private_key_error = get_error.__func__(100016, "Account Error, encrypt private key error,")77 decrypt_encrypted_private_key_error = get_error.__func__(100017,78 "Account Error, decrypt encrypted private key error.")7980 param_length_err = get_error.__func__(200001, "Uint256 Error,param length error")81 checksum_not_validate = get_error.__func__(200002, "Base800 Error,Checksum does not validate")82 input_too_short = get_error.__func__(200003, "Base800 Error,Input too short")83 unknown_curve = get_error.__func__(200004, "Curve Error,unknown curve")84 unknown_curve_label = get_error.__func__(200005, "Curve Error,unknown curve label")85 unknown_asymmetric_key_type = get_error.__func__(200006, "keyType Error,unknown asymmetric key type")86 invalid_signature_data = get_error.__func__(200007,87 "Signature Error, invalid signature data: missing the ID parameter for SM3withSM2")88 invalid_signature_data_len = get_error.__func__(200008, "Signature Error, invalid signature data length")89 malformed_signature = get_error.__func__(200009, "Signature Error, malformed signature")90 unsupported_signature_scheme = get_error.__func__(200010, "Signature Error, unsupported signature scheme:")91 data_signature_err = get_error.__func__(200011, "Signature Error, Data signature error.")92 un_support_operation = get_error.__func__(200012, "Address Error, UnsupportedOperationException")9394 # Core Error95 tx_deserialize_error = get_error.__func__(300001, "Core Error, Transaction deserialize failed")96 block_deserialize_error = get_error.__func__(300002, "Core Error, Block deserialize failed")9798 # merkle error99 merkle_verifier_err = get_error.__func__(400001, "Wrong params: the tree size is smaller than the leaf index")100 target_hashes_err = get_error.__func__(400002, "targetHashes error")101102 @staticmethod103 def constructed_root_hash_err(msg: str) -> dict:104 return ErrorCode.get_error(400003, "Other Error, " + msg)105106 assert_failed_hash_full_tree = get_error.__func__(400004, "assert failed in hash full tree")107 left_tree_full = get_error.__func__(400005, "left tree always full")108109 # SmartCodeTx Error110 send_raw_tx_error = get_error.__func__(800001, "SmartCodeTx Error, sendRawTransaction error")111 type_error = get_error.__func__(800002, "SmartCodeTx Error, type error")112113 # OntIdTx Error114 null_code_hash = get_error.__func__(800003, "OntIdTx Error, null codeHash")115 param_error = get_error.__func__(800004, "param error")116117 @staticmethod118 def param_err(msg: str):119 return ErrorCode.get_error(800005, msg)120121 did_null = get_error.__func__(800006, "OntIdTx Error, SendDid or receiverDid is null in metaData")122 not_exist_claim_issuer = get_error.__func__(800007, "OntIdTx Error, Not exist claim issuer")123 not_found_public_key_id = get_error.__func__(800008, "OntIdTx Error, not found PublicKeyId")124 public_key_id_err = get_error.__func__(800009, "OntIdTx Error, PublicKeyId err")125 block_height_not_match = get_error.__func__(800010, "OntIdTx Error, BlockHeight not match")126 nodes_not_match = get_error.__func__(800011, "OntIdTx Error, nodes not match")127 result_is_null = get_error.__func__(800012, "OntIdTx Error, result is null")128 create_ont_id_claim_err = get_error.__func__(800013, "OntIdTx Error, createOntIdClaim error")129 verify_ont_id_claim_err = get_error.__func__(800014, "OntIdTx Error, verifyOntIdClaim error")130 write_var_bytes_error = get_error.__func__(800015, "OntIdTx Error, writeVarBytes error")131 send_raw_transaction_pre_exec = get_error.__func__(800016, "OntIdTx Error, sendRawTransaction PreExec error")132 sender_amt_not_eq_password_amt = get_error.__func__(800017,133 "OntIdTx Error, senders amount is not equal password amount")134 expire_err = get_error.__func__(800017, "OntIdTx Error, expire is wrong")135136 @staticmethod137 def get_status_err(msg: str) -> dict:138 return ErrorCode.get_error(800017, "GetStatus Error," + msg)139140 # OntAsset Error141 asset_name_error = get_error.__func__(800101, "OntAsset Error, asset name error")142 did_error = get_error.__func__(800102, "OntAsset Error, Did error")143 null_pk_id = get_error.__func__(800103, "OntAsset Error, null pkId")144 null_claim_id = get_error.__func__(800104, "OntAsset Error, null claimId")145 amount_error = get_error.__func__(800105, "OntAsset Error, amount or gas is less than or equal to zero")146 param_length_not_same = get_error.__func__(800105, "OntAsset Error, param length is not the same")147148 # RecordTx Error149 null_key_or_value = get_error.__func__(800201, "RecordTx Error, null key or value")150 null_key = get_error.__func__(800202, "RecordTx Error, null key")151152 # OntSdk Error153 web_socket_not_init = get_error.__func__(800301, "OntSdk Error, web socket not init")154 conn_restful_not_init = get_error.__func__(800302, "OntSdk Error, connRestful not init")155156 # abi error157 set_params_value_value_num_error = get_error.__func__(800401, "AbiFunction Error, setParamsValue value num error")158 connect_url_err = get_error.__func__(800402, "Interfaces Error, connect error:")159160 @staticmethod161 def connect_err(msg: str) -> dict:162 return ErrorCode.get_error(800403, "connect error: " + msg)163164 # WalletManager Error165 get_account_by_address_err = get_error.__func__(800501, "WalletManager Error, get account by address error")166 get_default_account_err = get_error.__func__(800502, "WalletManager Error, get default account error")167 get_account_by_index_err = get_error.__func__(800503, 'WalletManager Error, get account by index error')168169 @staticmethod170 def other_error(msg: str) -> dict: ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful