Skip to content

Commit a3244c4

Browse files
JaroslawLegierskisbernard31
authored andcommitted
GH-1524: Error handling improvement in SendHandler.
1 parent 401a204 commit a3244c4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

leshan-server-core/src/main/java/org/eclipse/leshan/server/send/SendHandler.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.eclipse.leshan.core.node.TimestampedLwM2mNodes;
2525
import org.eclipse.leshan.core.peer.LwM2mPeer;
2626
import org.eclipse.leshan.core.request.SendRequest;
27+
import org.eclipse.leshan.core.request.exception.InvalidRequestException;
2728
import org.eclipse.leshan.core.response.SendResponse;
2829
import org.eclipse.leshan.core.response.SendableResponse;
2930
import org.eclipse.leshan.server.registration.Registration;
@@ -93,7 +94,9 @@ public void run() {
9394
onError(updatedRegistration, String.format("Invalid Send Request, server returns %s %s", //
9495
sendResponse.getCode().getName(), //
9596
sendResponse.getErrorMessage() != null ? "because" + sendResponse.getErrorMessage() : ""),
96-
null);
97+
new InvalidRequestException(
98+
sendResponse.getErrorMessage() != null ? sendResponse.getErrorMessage()
99+
: "unknown reason"));
97100
}
98101
}
99102

0 commit comments

Comments
 (0)