From d53d473481162ded0485aa9694fe0dae6eb1ae34 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Wed, 16 Nov 2011 14:03:12 +0200 Subject: [PATCH] throw exception as opposed to returning false when a job errors --- .../java/org/jclouds/cloudstack/predicates/JobComplete.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/predicates/JobComplete.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/predicates/JobComplete.java index fe01bcc226..6f286d8d89 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/predicates/JobComplete.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/predicates/JobComplete.java @@ -55,9 +55,11 @@ public class JobComplete implements Predicate { if (job == null) return false; logger.trace("%s: looking for job status %s: currently: %s", job.getId(), 1, job.getStatus()); - if (job.getError() != null) - throw new IllegalStateException(String.format("job %s failed with exception %s", job.getId(), job.getError() + if (job.getError() != null) { + // TODO: create a typed error + throw new RuntimeException(String.format("job %s failed with exception %s", job.getId(), job.getError() .toString())); + } return job.getStatus() > 0; }