Skip to content

Commit

Permalink
handle null e.getMessage()
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielBrascher committed Aug 21, 2020
1 parent c2be3c9 commit cc8068c
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -139,7 +139,13 @@ public void execute() {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
} catch (Exception e) {
e.printStackTrace();
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to move vm " + e.getMessage());
if (e.getMessage() != null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to move vm due to %s", this.getVmId(), e.getMessage()));
} else if (e.getCause() != null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to move vm due to %s", this.getVmId(), e.getCause()));
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to move vm", this.getVmId()));
}
}

}
Expand Down

0 comments on commit cc8068c

Please sign in to comment.