diff --git a/src/uk/org/floop/jenkins_pmd/Drafter.groovy b/src/uk/org/floop/jenkins_pmd/Drafter.groovy
index 59a3b62..0eef84b 100644
--- a/src/uk/org/floop/jenkins_pmd/Drafter.groovy
+++ b/src/uk/org/floop/jenkins_pmd/Drafter.groovy
@@ -212,11 +212,4 @@
 
 }
 
-class DrafterException extends Throwable {
-    String message
-
-    DrafterException(String message) {
-        this.message = message
-    }
-
-}
+class DrafterException extends Exception { }
diff --git a/src/uk/org/floop/jenkins_pmd/Pipelines.groovy b/src/uk/org/floop/jenkins_pmd/Pipelines.groovy
index 1adc84e..4c9faa8 100644
--- a/src/uk/org/floop/jenkins_pmd/Pipelines.groovy
+++ b/src/uk/org/floop/jenkins_pmd/Pipelines.groovy
@@ -83,10 +83,4 @@
     }
 }
 
-class PipelineException extends Throwable {
-    String message
-
-    PipelineException(String message) {
-        this.message = message
-    }
-}
\ No newline at end of file
+class PipelineException extends Exception { }
\ No newline at end of file
diff --git a/test/integration/groovy/uk/org/floop/jenkins_pmd/DrafterTests.groovy b/test/integration/groovy/uk/org/floop/jenkins_pmd/DrafterTests.groovy
index 8591a92..d2a3e21 100644
--- a/test/integration/groovy/uk/org/floop/jenkins_pmd/DrafterTests.groovy
+++ b/test/integration/groovy/uk/org/floop/jenkins_pmd/DrafterTests.groovy
@@ -251,5 +251,34 @@
         rule.assertLogContains('Publishing job draft', firstResult)
     }
 
+    @Test
+    void "replace non-existant draftset"() {
+        instanceRule.stubFor(get(urlMatching("/v1/draftsets.*"))
+                .withHeader("Accept", equalTo("application/json"))
+                .withBasicAuth("admin", "admin")
+                .willReturn(ok()
+                .withBodyFile("listDraftsetsWithoutProject.json")
+                .withHeader("Content-Type", "application/json")))
+        instanceRule.stubFor(post("/v1/draftsets?display-name=project")
+                .withHeader("Accept", equalTo("application/json"))
+                .withBasicAuth("admin", "admin")
+                .willReturn(seeOther("/v1/draftset/4e376c57-6816-404a-8945-94849299f2a0")))
+        instanceRule.stubFor(get("/v1/draftset/4e376c57-6816-404a-8945-94849299f2a0")
+                .withHeader("Accept", equalTo("application/json"))
+                .withBasicAuth("admin", "admin")
+                .willReturn(ok()
+                .withBodyFile("newDraftset.json")
+                .withHeader("Content-Type", "application/json")))
+        final CpsFlowDefinition flow = new CpsFlowDefinition('''
+        node {
+            jobDraft.replace()
+        }'''.stripIndent(), true)
+        final WorkflowJob workflowJob = rule.createProject(WorkflowJob, 'project')
+        workflowJob.definition = flow
+
+        final WorkflowRun firstResult = rule.buildAndAssertSuccess(workflowJob)
+        //instanceRule.verify(postRequestedFor(urlEqualTo("/v1/draftset/4e376c57-6816-404a-8945-94849299f2a0/publish")))
+        rule.assertLogContains('no job draft to delete', firstResult)
+    }
 
 }
diff --git a/test/resources/__files/listDraftsetsWithoutProject.json b/test/resources/__files/listDraftsetsWithoutProject.json
new file mode 100644
index 0000000..6741754
--- /dev/null
+++ b/test/resources/__files/listDraftsetsWithoutProject.json
@@ -0,0 +1,19 @@
+[
+  {
+    "id": "de305d54-75b4-431b-adb2-eb6b9e546014",
+    "changes": {
+      "http://opendatacommunities.org/graph/homelessness/households-accommodated/temporary-housing-types": {
+        "status": "updated"
+      },
+      "http://opendatacommunities.org/data/labour-force/employment-rate/employment-rate-by-age": {
+        "status": "deleted"
+      }
+    },
+    "display-name": "New Temporary Housing Figures",
+    "description": "Quarterly updates for Q4 2015",
+    "updated-at": "2016-01-04T13:35:21.000Z",
+    "created-at": "2016-01-01T13:35:21.000Z",
+    "current-owner": "admin@opendatacommunities.org",
+    "submitted-by": "editor@opendatacommunities.org"
+  }
+]
\ No newline at end of file
diff --git a/vars/jobDraft.groovy b/vars/jobDraft.groovy
index 1c0fd7e..6718f7c 100644
--- a/vars/jobDraft.groovy
+++ b/vars/jobDraft.groovy
@@ -19,7 +19,7 @@
     echo "Replacing job draft"
     try {
         delete()
-    } catch(e) {
+    } catch(Exception e) {
         echo "(no job draft to delete)"
     } finally {
         create()