iota-java icon indicating copy to clipboard operation
iota-java copied to clipboard

Rewrite Thrown exceptions

Open kwek20 opened this issue 7 years ago • 3 comments

Issue

Currently most exceptions are thrown into one big pile called ArgumentException. We should specify between derivatives of RuntimeException for input parameters, and specific derivatives of ArgumentException for node errors.

Motivation

You should only handle errors you are able to handle. Therefor you should only catch errors you can process. By having one exception contain all the errors, we are prone to mistakes

kwek20 avatar Oct 28 '18 17:10 kwek20

There is: https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/HttpException.html from apache

Or https://docs.oracle.com/javase/8/docs/api/index.html?javax/xml/ws/http/HTTPException.html

It is also possible to create a custom exception

GalRogozinski avatar Mar 26 '19 15:03 GalRogozinski

We need to see if we can have Jota throw different exception depending on the cause of the error. I am especially interested on the case of finding TimeoutExceptions on the server side.

GalRogozinski avatar Apr 12 '19 13:04 GalRogozinski

Make sure to refactor the HttpConnector wrapException method and use this approach instead: https://github.com/square/retrofit/issues/1497

ezienecker avatar Oct 16 '20 10:10 ezienecker