I am using getAccount to confirm if this account exist. while it exist the function return correct data.
but if the account does not exist, it throws an exception, and catch does not work. is this normal behaviour? why not simply return error msg instead?
api < error undefined http://peer1.eoshuobipool.com:8181/v1/chain/get_account {"account_name":"nonexistaccount"}
{ Error: {"code":500,"message":"Internal Service Error","error":{"code":3010001,"name":"name_type_exception","what":"Invalid name","details":[]}}
at /node_modules/eosjs-api/lib/apigen.js:95:23
at
at process._tickCallback (internal/process/next_tick.js:188:7) status: 500, statusText: 'Internal Server Error' }
(node:88344) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: {"code":500,"message":"Internal Service Error","error":{"code":3010001,"name":"name_type_exception","what":"Invalid name","details":[]}}
(node:88344) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
test code:
tested both on mainnet and testnet: httpEndpoint: 'http://peer1.eoshuobipool.com:8181', httpEndpoint: 'http://jungle.cryptolions.io:38888',
I am using getAccount to confirm if this account exist. while it exist the function return correct data. but if the account does not exist, it throws an exception, and catch does not work. is this normal behaviour? why not simply return error msg instead?