tronprotocol / tronweb

Javascript API Library for interacting with the TRON Network
MIT License
446 stars 279 forks source link

Error messages determination and handling #508

Closed mykhailohordin closed 4 months ago

mykhailohordin commented 7 months ago

Tronweb Version: "5.1.1" Node Version: "20.11"

Since GreatVoyage-v4.7.3(Chilon) of tronprotocol/java-tron with PR#5426 was released I have faced a problem with the error handling, because some of providers didn`t update the version of tronprotocol/java-tron on the nodes.

For example:

Provider#1 will throw such kind of error: frozenBalance must be more than 1TRX - Before GreatVoyage-v4.7.3(Chilon) While Provider#2 will throw at the same time: frozenBalance must be greater than or equal to 1 TRX - After GreatVoyage-v4.7.3(Chilon)

Question#1: Is there any plan to handle such kind of errors and redetermine them to one fixed representation. Question#2: Is there any plan to include possible error messages as an enum inside TypeScript version of TronWeb. It would be great because developers could expect what kind of errors they, possibly, would catch.

Details of the PR#5426 issue.

DmytroShalaiev commented 7 months ago

I have the same thoughts, it will be cool to keep a list of errors in tronWeb and sync it with tron-node on updates.

start940315 commented 6 months ago

As we know, the java-tron API interface currently has various error codes, some of which will change with version iterations. TronWeb has no plans to support these in the near future, but we will take this as an enhancement in the future. It is currently recommended that you handle it yourself. If you have any questions, please feel free to contact us.

DmytroShalaiev commented 6 months ago

Thanks for reply, I think it will nice for the future integrations and UX