vshymanskyy / TinyGSM

A small Arduino library for GSM modules, that just works
GNU Lesser General Public License v3.0
1.97k stars 725 forks source link

Missing error handling and drops return code from waitResponse, etc. #788

Open mikemorettiag opened 7 months ago

mikemorettiag commented 7 months ago

sendAT returns void when it should be returning some kind of error code. inside, it calls some uart/streaming stuff and ignores any return code/errors from that as well. waitResponse processes all the various AT command responses you pass it (which is a really odd way to handle response errors) and returns some index value based on the params you pass, but 90% of the things in tinygsm's code that call it don't check the return value and drop it. there are a bunch of other places where error handling is not done. all this makes it next to impossible to figure out why a connection failed (and no, don't say "turn on debug logging", because most of the time you can't do that in production in the field and see it on some console). there should be a way programmatically via the tinygsm api to determine proper error status of everything you can call in it so that you can handle errors appropriately in your calling code.