Skip to content

Commit ab2759b

Browse files
authored
Merge pull request #288 from jglick/MissingContextVariableException
Improved usage of `MissingContextVariableException`
2 parents 2b19db7 + 451c815 commit ab2759b

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

pom.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@
5656
<scope>import</scope>
5757
<type>pom</type>
5858
</dependency>
59+
<!-- TODO until in BOM: -->
60+
<dependency>
61+
<groupId>org.jenkins-ci.plugins.workflow</groupId>
62+
<artifactId>workflow-step-api</artifactId>
63+
<version>655.v6e098b_87b_84f</version>
64+
</dependency>
65+
<dependency>
66+
<groupId>org.jenkins-ci.plugins.workflow</groupId>
67+
<artifactId>workflow-step-api</artifactId>
68+
<classifier>tests</classifier>
69+
<version>655.v6e098b_87b_84f</version>
70+
</dependency>
5971
</dependencies>
6072
</dependencyManagement>
6173
<dependencies>
@@ -70,7 +82,6 @@
7082
<dependency>
7183
<groupId>org.jenkins-ci.plugins.workflow</groupId>
7284
<artifactId>workflow-step-api</artifactId>
73-
<version>655.v6e098b_87b_84f</version> <!-- TODO: Removes once the plugin is updated in the BOM -->
7485
</dependency>
7586
<dependency>
7687
<groupId>org.jenkins-ci.plugins</groupId>

src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/BindingStep.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private void doStart() throws Exception {
127127
for (MultiBinding<?> binding : step.bindings) {
128128
if (binding.getDescriptor().requiresWorkspace() &&
129129
(workspace == null || launcher == null)) {
130-
throw new MissingContextVariableException(FilePath.class);
130+
throw new MissingContextVariableException(FilePath.class, step.getDescriptor());
131131
}
132132
MultiBinding.MultiEnvironment environment = binding.bind(run, workspace, launcher, listener);
133133
unbinders.add(environment.getUnbinder());

src/test/java/org/jenkinsci/plugins/credentialsbinding/impl/BindingStepTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public void widerRequiredContext() throws Throwable {
218218
WorkflowRun b = r.assertBuildStatus(Result.FAILURE, p.scheduleBuild2(0));
219219
r.assertLogNotContains("We should fail before getting here", b);
220220
r.assertLogContains("Required context class hudson.FilePath is missing", b);
221-
r.assertLogContains("Perhaps you forgot to surround the step with a step that provides this, such as: node", b);
221+
r.assertLogContains("Perhaps you forgot to surround the withCredentials step with a step that provides this, such as: node", b);
222222
});
223223
}
224224

0 commit comments

Comments
 (0)