Skip to content

Commit

Permalink
Merge pull request #231 from mdaxini/fix-errorResonse
Browse files Browse the repository at this point in the history
Make error response message visible in response, and add missing exception messages for endpoints.
  • Loading branch information
mdaxini authored Mar 2, 2019
2 parents 094fb50 + ae2ecbf commit 0c7764e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public Response initfromscript(@FormDataParam("dynamicplugin") String dynamicPlu

} catch (Exception e) {
logger.error("Error initializing dynamic plugin from script", e);
return sendErrorResponse("script initialization failed for dynamic plugin!"+e);
return sendErrorResponse("script initialization failed for dynamic plugin!" + e.getMessage());

}
}
Expand All @@ -105,7 +105,7 @@ public Response startDataFill() throws Exception {
return sendSuccessResponse("data fill done!");
} catch (Exception e) {
logger.error("Error starting datafill", e);
return sendErrorResponse("dataFill failed!");
return sendErrorResponse("dataFill failed!" + e.getMessage());
}
}

Expand All @@ -122,7 +122,7 @@ public Response startDataFillAsync() throws Exception {
return sendSuccessResponse( "Async data fill started !");
} catch (Exception e) {
logger.error("Error starting datafill", e);
return sendErrorResponse("Async dataFill failed to start!");
return sendErrorResponse("Async dataFill failed to start!" + e.getMessage());
}
}

Expand All @@ -139,7 +139,7 @@ public Response conditionalBackfill() throws Exception {
return sendSuccessResponse("data fill done!");
} catch (Exception e) {
logger.error("Error starting datafill", e);
return sendErrorResponse("dataFill failed!");
return sendErrorResponse("dataFill failed!" + e.getMessage());
}
}

Expand All @@ -156,7 +156,7 @@ public Response verifyBackfill() throws Exception {
return sendSuccessResponse("data fill done!");
} catch (Exception e) {
logger.error("Error starting datafill", e);
return sendErrorResponse("dataFill failed!");
return sendErrorResponse("dataFill failed!" + e.getMessage());
}
}

Expand All @@ -172,7 +172,7 @@ public Response stopDataFill() throws Exception {
return sendSuccessResponse("data fill stop!" );
} catch (Exception e) {
logger.error("Error stop datafill", e);
return sendErrorResponse("dataFill failed!");
return sendErrorResponse("dataFill failed!" + e.getMessage());
}
}

Expand All @@ -190,7 +190,7 @@ public Response shutdownDataFill() throws Exception {
return sendSuccessResponse("data fill stop!" );
} catch (Exception e) {
logger.error("Error shutdown datafill", e);
return sendErrorResponse("dataFill failed!");
return sendErrorResponse("dataFill failed!" + e.getMessage());
}
}

Expand All @@ -206,7 +206,7 @@ public Response init(@PathParam("client") String clientName) throws Exception {
return sendSuccessResponse("NdBench client initiated!");
} catch (Exception e) {
logger.error("Error initializing the client - "+clientName, e);
return sendErrorResponse("Client initialization failed!");
return sendErrorResponse("Client initialization failed!" + e.getMessage());
}
}

Expand Down Expand Up @@ -328,7 +328,7 @@ public Response stop() throws Exception {
return sendSuccessResponse("NdBench test stopped!");
} catch (Exception e) {
logger.error("Error stopping NdBench test", e);
return sendErrorResponse("NdBench stop failed! "+ e.getMessage());
return sendErrorResponse("NdBench stop failed! " + e.getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,14 @@ public SuccessResponse(String successMessage)
public static class Result
{
public boolean isSuccess;
String message;
public String message;

Result(boolean result, String resultMessage)
{
this.isSuccess = result;
this.message=resultMessage;
}

public Result(boolean result)
{
this.isSuccess = result;
Expand Down

0 comments on commit 0c7764e

Please sign in to comment.