Skip to content

Commit

Permalink
[JENKINS-38157] When a NoStaplerConstructorException is thrown, inclu…
Browse files Browse the repository at this point in the history
…de details in the exception message so it has a better chance of being diagnosed.
  • Loading branch information
jglick committed Sep 13, 2016
1 parent 4197762 commit 4efc5a9
Showing 1 changed file with 8 additions and 4 deletions.
Expand Up @@ -254,10 +254,14 @@ public T instantiate(Map<String,?> arguments) throws Exception {
arguments = Collections.singletonMap(rp.getName(),arguments.get(ANONYMOUS_KEY));
}

Object[] args = buildArguments(arguments, constructor.getGenericParameterTypes(), constructorParamNames, true);
T o = constructor.newInstance(args);
injectSetters(o, arguments);
return o;
try {
Object[] args = buildArguments(arguments, constructor.getGenericParameterTypes(), constructorParamNames, true);
T o = constructor.newInstance(args);
injectSetters(o, arguments);
return o;
} catch (Exception x) {
throw new IllegalArgumentException("Could not instantiate " + arguments + " for " + this + ": " + x, x);
}
}

// adapted from RequestImpl
Expand Down

0 comments on commit 4efc5a9

Please sign in to comment.