RuleEngineException cause added to be able to analyse cause by rate limit exceptions
This commit is contained in:
		
							parent
							
								
									859c820dc3
								
							
						
					
					
						commit
						825eaf640c
					
				@ -232,7 +232,7 @@ public class RuleChainActorMessageProcessor extends ComponentMsgProcessor<RuleCh
 | 
			
		||||
        } catch (RuleNodeException rne) {
 | 
			
		||||
            msg.getCallback().onFailure(rne);
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            msg.getCallback().onFailure(new RuleEngineException(e.getMessage()));
 | 
			
		||||
            msg.getCallback().onFailure(new RuleEngineException(e.getMessage(), e));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -335,7 +335,7 @@ public class RuleChainActorMessageProcessor extends ComponentMsgProcessor<RuleCh
 | 
			
		||||
            msg.getCallback().onFailure(rne);
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            log.warn("[" + tenantId + "]" + "[" + entityId + "]" + "[" + msg.getId() + "]" + " onTellNext failure", e);
 | 
			
		||||
            msg.getCallback().onFailure(new RuleEngineException("onTellNext - " + e.getMessage()));
 | 
			
		||||
            msg.getCallback().onFailure(new RuleEngineException("onTellNext - " + e.getMessage(), e));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -349,7 +349,7 @@ public class DefaultTbRuleEngineConsumerService extends AbstractConsumerService<
 | 
			
		||||
                callback.onSuccess();
 | 
			
		||||
            }
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            callback.onFailure(new RuleEngineException(e.getMessage()));
 | 
			
		||||
            callback.onFailure(new RuleEngineException(e.getMessage(), e));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -32,6 +32,11 @@ public class RuleEngineException extends Exception {
 | 
			
		||||
        ts = System.currentTimeMillis();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public RuleEngineException(String message, Throwable t) {
 | 
			
		||||
        super(message != null ? message : "Unknown", t);
 | 
			
		||||
        ts = System.currentTimeMillis();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String toJsonString() {
 | 
			
		||||
        try {
 | 
			
		||||
            return mapper.writeValueAsString(mapper.createObjectNode().put("message", getMessage()));
 | 
			
		||||
 | 
			
		||||
@ -40,6 +40,6 @@ public class MultipleTbQueueCallbackWrapper implements TbQueueCallback {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onFailure(Throwable t) {
 | 
			
		||||
        callback.onFailure(new RuleEngineException(t.getMessage()));
 | 
			
		||||
        callback.onFailure(new RuleEngineException(t.getMessage(), t));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -41,6 +41,6 @@ public class MultipleTbQueueTbMsgCallbackWrapper implements TbQueueCallback {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onFailure(Throwable t) {
 | 
			
		||||
        tbMsgCallback.onFailure(new RuleEngineException(t.getMessage()));
 | 
			
		||||
        tbMsgCallback.onFailure(new RuleEngineException(t.getMessage(), t));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -35,6 +35,6 @@ public class TbQueueTbMsgCallbackWrapper implements TbQueueCallback {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onFailure(Throwable t) {
 | 
			
		||||
        tbMsgCallback.onFailure(new RuleEngineException(t.getMessage()));
 | 
			
		||||
        tbMsgCallback.onFailure(new RuleEngineException(t.getMessage(), t));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -39,7 +39,7 @@ public class MultipleTbMsgsCallbackWrapper implements TbMsgCallbackWrapper {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onFailure(Throwable t) {
 | 
			
		||||
        callback.onFailure(new RuleEngineException(t.getMessage()));
 | 
			
		||||
        callback.onFailure(new RuleEngineException(t.getMessage(), t));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user