refactor server side exception handling, better error messages in client

This commit is contained in:
Aidan Hahn 2019-05-19 13:26:15 -07:00
parent a932852b2c
commit b74741427c
No known key found for this signature in database
GPG key ID: 327711E983899316
2 changed files with 19 additions and 10 deletions

View file

@ -94,7 +94,7 @@ public class JobServClient {
// blocking network operation
response = blockingStub.getOutput(request);
} catch (StatusRuntimeException e) {
logger.log(Level.WARNING, "[-] Request for output failed: %s", e.getStatus());
logger.log(Level.WARNING, "(API Failure) Request for output failed: %s", e.getMessage());
return "<Error connecting to API>";
}
@ -119,7 +119,7 @@ public class JobServClient {
// blocking network operation
response = blockingStub.newJob(request);
} catch (StatusRuntimeException e) {
logger.log(Level.WARNING, "[-] Request for new job failed!");
logger.log(Level.WARNING, "(API Failure) Request for new job failed: %s", e.getMessage());
return -1;
}
@ -147,7 +147,7 @@ public class JobServClient {
// blocking network operation
response = blockingStub.getStatus(request);
} catch (StatusRuntimeException e) {
logger.log(Level.WARNING, "[-] Request for status failed!");
logger.log(Level.WARNING, "(API Failure) Request for status failed: %s", e.getMessage());
return false;
}
@ -172,7 +172,7 @@ public class JobServClient {
// blocking network operation
response = blockingStub.getReturn(request);
} catch (StatusRuntimeException e) {
logger.log(Level.WARNING, "[-] Failed to get return code!");
logger.log(Level.WARNING, "(API Failure) Failed to get return code: %s", e.getMessage());
return 278;
}
@ -196,7 +196,7 @@ public class JobServClient {
// blocking network operation
response = blockingStub.killJob(request);
} catch (StatusRuntimeException e) {
logger.log(Level.WARNING, "[-] Failed to send request!");
logger.log(Level.WARNING, "(API Failure) Failed to send request: %s", e.getMessage());
return;
}