Skip to content

Commit f400f8c

Browse files
gselzerhinerm
authored andcommitted
Suppress adaptation exception
1 parent fe6fa6e commit f400f8c

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎scijava/scijava-ops/src/main/java/org/scijava/ops/impl/DefaultOpEnvironment.java‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,16 @@ private OpCandidate findOpCandidate(OpRef ref, boolean adaptable, boolean simpli
312312
return findSimplifiedOp(ref);
313313
}
314314
catch (OpMatchingException e3) {
315-
// no direct, adapted, or simplified matches
316-
OpMatchingException matchingException = new OpMatchingException(
317-
"No Op available for request: " + ref, e1);
318-
matchingException.addSuppressed(e2);
319-
matchingException.addSuppressed(e3);
320-
throw matchingException;
315+
// NB: It is important that the adaptation and simplification errors be
316+
// suppressed here. If a failure occurs in Op matching, it
317+
// is not the fault of our adaptation/simplification process but is
318+
// instead due to the incongruity between the request and the set of
319+
// available Ops. Thus the error stemming from the direct match
320+
// attempt will provide the user with more information on how to fix
321+
// their Op request.
322+
e1.addSuppressed(e2);
323+
e1.addSuppressed(e3);
324+
throw e1;
321325
}
322326
}
323327
}

0 commit comments

Comments
 (0)