File tree Expand file tree Collapse file tree
library/Icinga/Application/Hook Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66namespace Icinga \Application \Hook ;
77
88use Icinga \Application \Hook ;
9+ use Icinga \Application \Logger ;
910use ipl \Html \ValidHtml ;
1011use RuntimeException ;
12+ use Throwable ;
1113
1214/**
1315 * Base class for the PDF Export Hook
@@ -24,11 +26,20 @@ public static function first()
2426 if (! Hook::has ('Pdfexport ' )) {
2527 throw new RuntimeException ('No PDF exporter available ' );
2628 }
27- $ pdfexport = Hook::first ('Pdfexport ' );
28- if (! $ pdfexport ->isSupported ()) {
29- throw new RuntimeException ('PDF exporter is not supported ' );
29+
30+ foreach (Hook::all ('Pdfexport ' ) as $ exporter ) {
31+ try {
32+ if (! $ exporter ->isSupported ()) {
33+ continue ;
34+ }
35+
36+ return $ exporter ;
37+ } catch (Throwable $ e ) {
38+ Logger::error ('PDF exporter reported an error during support check: %s ' , $ e );
39+ }
3040 }
31- return $ pdfexport ;
41+
42+ throw new RuntimeException ('Not supported PDF exporter available ' );
3243 }
3344
3445 /**
You can’t perform that action at this time.
0 commit comments