Skip to content

Commit 7491833

Browse files
committed
Try to have a useful message if provider failed
1 parent c48cb91 commit 7491833

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/tuwien/auto/calimero/serial/ConnectionFactory.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Calimero 2 - A library for KNX network access
3-
Copyright (c) 2022, 2024 B. Malinowsky
3+
Copyright (c) 2022, 2025 B. Malinowsky
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -79,7 +79,10 @@ public C open(final String name, final ThrowingFunction<P, C> openFunc) throws K
7979
return Optional.of(conn);
8080
}
8181
catch (KNXException | IOException | RuntimeException | ExceptionInInitializerError t) {
82-
logger.debug("{} unsuccessful: {}", provider, t.getMessage());
82+
var msg = t.getMessage();
83+
if (msg == null)
84+
msg = t.getCause() != null ? t.getCause().getMessage() : t.getClass().getSimpleName();
85+
logger.debug("{} unsuccessful: {}", provider, msg);
8386
providerExceptions.add(t);
8487
return Optional.<C>empty();
8588
}

0 commit comments

Comments
 (0)