xbee-java icon indicating copy to clipboard operation
xbee-java copied to clipboard

Provide better error handling for too large payloads

Open jvalkeal opened this issue 9 years ago • 0 comments

As it is known fact that if you try to send payload which is too large for protocol in use, api will simply throw TimeoutException. It'd be extremely nice if digi lib would throw something like IllegalPayloadException if size is not supported. I'm not exactly sure how easy it is to know from an api perspective what is max supported payload size but if there is a way then digi's lib would be a place to impose that restriction.

I'm trying to make higher level library atop of digi and will try to make a protocol of some sort to be able to send larger payload by splitting and then reconstructing those on the other side. Not going crazy on this but I would not want to impose there size restrictions in my code as digi as a maintainer should know limits.

I was a little surprised that while testing too large payload using xctu, too large payload is simply dropped without any errors. I think same happens with java lib and is a bit inconvenient as you only get:

com.digi.xbee.api.exceptions.TimeoutException: There was a timeout while executing the requested operation.
	at com.digi.xbee.api.AbstractXBeeDevice.sendXBeePacket(AbstractXBeeDevice.java:1237) ~[xbee-java-library-1.2.0.jar!/:1.2.0]
	at com.digi.xbee.api.AbstractXBeeDevice.sendAndCheckXBeePacket(AbstractXBeeDevice.java:1401) ~[xbee-java-library-1.2.0.jar!/:1.2.0]
	at com.digi.xbee.api.XBeeDevice.sendData(XBeeDevice.java:853) ~[xbee-java-library-1.2.0.jar!/:1.2.0]
	at com.digi.xbee.api.XBeeDevice.sendBroadcastData(XBeeDevice.java:994) ~[xbee-java-library-1.2.0.jar!/:1.2.0]

You don't know if it's a real timeout or too large payload.

jvalkeal avatar Mar 19 '17 16:03 jvalkeal