use of org.openkilda.floodlight.flow.response.FlowErrorResponse.FlowErrorResponseBuilder in project open-kilda by telstra.
the class FlowSegmentReport method assembleResponse.
private SpeakerResponse assembleResponse() {
FlowErrorResponseBuilder errorResponse = makeErrorTemplate();
try {
raiseError();
return makeSuccessReply();
} catch (SwitchNotFoundException e) {
errorResponse.errorCode(ErrorCode.SWITCH_UNAVAILABLE);
} catch (SessionErrorResponseException e) {
decodeError(errorResponse, e.getErrorResponse());
} catch (SwitchMissingFlowsException e) {
errorResponse.errorCode(ErrorCode.MISSING_OF_FLOWS);
errorResponse.description(e.getMessage());
} catch (SwitchOperationException e) {
errorResponse.errorCode(ErrorCode.UNKNOWN);
errorResponse.description(e.getMessage());
} catch (Exception e) {
log.error(String.format("Unhandled exception while processing command %s", command), e);
errorResponse.errorCode(ErrorCode.UNKNOWN);
}
FlowErrorResponse response = errorResponse.build();
log.error("Command {} have failed - {} {}", command, response.getErrorCode(), response.getDescription());
return response;
}
Aggregations