Commit 6ab6e3b7 authored by Spiros Koulouzis's avatar Spiros Koulouzis

Print exeption

parent e1d04a45
......@@ -22,10 +22,12 @@ package nl.uva.sne.drip.api.exception;
public class ExceptionHandler {
public static RuntimeException generateException(String name, String value) {
if (value == null) {
return new InternalServerErrorExeption();
}
if (value.contains("The maximum number of VPCs has been reached")) {
return new VMLimitException(name + "." + value);
}
else{
} else {
return new InternalServerErrorExeption();
}
}
......
......@@ -130,7 +130,7 @@ public class ProvisionController {
try (DRIPCaller provisioner = new ProvisionerCaller(messageBrokerHost);) {
Message provisionerInvokationMessage = buildProvisionerMessage(req);
Message response = (provisioner.call(provisionerInvokationMessage));
Message response = (provisioner.call(provisionerInvokationMessage));
// Message response = generateFakeResponse();
List<MessageParameter> params = response.getParameters();
......@@ -138,7 +138,9 @@ public class ProvisionController {
for (MessageParameter p : params) {
String name = p.getName();
if (name.toLowerCase().contains("exception")) {
throw ExceptionHandler.generateException(name, p.getValue());
RuntimeException ex = ExceptionHandler.generateException(name, p.getValue());
Logger.getLogger(ProvisionController.class.getName()).log(Level.SEVERE, null, ex);
throw ex;
}
if (!name.equals("kubernetes")) {
String value = p.getValue();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment