File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ public UpdateControl<P> execute() throws Exception {
205
205
if (!exceptions .isEmpty ()) {
206
206
throw new AggregatedOperatorException ("One or more DependentResource(s) failed:\n " +
207
207
exceptions .stream ()
208
- .map (e -> " \t \t - " + e . getMessage () )
208
+ .map (Controller . this :: createExceptionInformation )
209
209
.collect (Collectors .joining ("\n " )),
210
210
exceptions );
211
211
}
@@ -215,6 +215,24 @@ public UpdateControl<P> execute() throws Exception {
215
215
});
216
216
}
217
217
218
+ private String createExceptionInformation (Exception e ) {
219
+ final var exceptionLocation = Optional .ofNullable (e .getCause ())
220
+ .map (Throwable ::getStackTrace )
221
+ .filter (stackTrace -> stackTrace .length > 0 )
222
+ .map (stackTrace -> {
223
+ int i = 0 ;
224
+ while (i < stackTrace .length ) {
225
+ final var moduleName = stackTrace [i ].getModuleName ();
226
+ if (!"java.base" .equals (moduleName )) {
227
+ return " at: " + stackTrace [i ].toString ();
228
+ }
229
+ i ++;
230
+ }
231
+ return "" ;
232
+ });
233
+ return "\t \t - " + e .getMessage () + exceptionLocation .orElse ("" );
234
+ }
235
+
218
236
public void initAndRegisterEventSources (EventSourceContext <P > context ) {
219
237
dependents .entrySet ().stream ()
220
238
.filter (drEntry -> drEntry .getValue () instanceof EventSourceProvider )
You can’t perform that action at this time.
0 commit comments