use of run.wallet.iota.api.handler.RequestHandler in project run-wallet-android by runplay.
the class IotaApiProvider method processRequest.
@Override
public ApiResponse processRequest(ApiRequest apiRequest) {
ApiResponse response = null;
try {
// Log.e("iotaApiProv",apiRequest.getClass()+" - "+this.requestHandlerMap.containsKey(apiRequest.getClass()));
if (this.requestHandlerMap.containsKey(apiRequest.getClass())) {
RequestHandler requestHandler = this.requestHandlerMap.get(apiRequest.getClass());
response = requestHandler.handle(apiRequest);
}
} catch (IllegalAccessError e) {
NetworkError error = new NetworkError();
error.setErrorType(NetworkErrorType.ACCESS_ERROR);
error.setMessage(e.getMessage());
response = error;
// if(error.getErrorType()==401 && e.getMessage().contains("getNeighbours"))
Log.e("ERR-API1", "" + e.getMessage());
} catch (Exception e) {
Log.e("ERR-API2", e.toString() + " -- " + e.getMessage());
response = new NetworkError();
}
return response == null ? new NetworkError() : response;
}
Aggregations