-
Notifications
You must be signed in to change notification settings - Fork 3k
Update BLE error calls to use new error codes and mbed_error #7726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind separating the astyle changes with the error code changes into two commits?
Astyle changes were unexpected, again some rebase issue. Let me fix that as well. |
@@ -529,7 +529,7 @@ class EddystoneService | |||
DBG("attached tlmCallback every %d seconds", TlmAdvPeriod); | |||
} | |||
if (NONE == frameIndex) { | |||
error("No Frames were Initialized! Please initialize a frame before starting an eddystone beacon."); | |||
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_BLE, MBED_ERROR_CODE_BLE_NO_FRAME_INITIALIZED), "No Frames were Initialized! Please initialize a frame before starting an eddystone beacon."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure there is value adding a new error for this specific case.
Would it be possible to use an INVALID_STATE
error instead ?
We already have code such as INVALID_ARGUMENT
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pan- The value here is to get maximum info about the error scenario just by decoding the error code even if there is no textual output. Please look at the error decoding microsite - https://armmbed.github.io/mbedos-error/. This website takes the error code and generates error context info. Once we integrate other features like device stats API for errors as well, the error-code info collected can be used to get more info. If you still think its not useful we can remove it. Let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the file and line number is reported, is it that useful to have very specific error code ? (If file and line are not accessible; it is very useful).
Do what feels right on this one :).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pan- - The line number/file is not reported by default. It needs a special flag MBED_CONF_PLATFORM_ERROR_FILENAME_CAPTURE_ENABLED. Irrespective of that we plan to report these error-codes into cloud/or other backends and thus having these error codes would provide us more info for analytics/later analysis. Does that makes sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's unfortunate it requires a special flag to report the filename and line number as without it the error code in this form is not very comprehensive.
Being dependent on a website to decipher an error code is, from my perspective, not ideal for debugging and it is also limited to the content we feed the website with. I hope their will be some way to run the webpage locally so it is in sync with the sources being run otherwise the whole error code mechanism will be very complex to use with application defined error codes.
Side question: how do you intend to capture in the cloud error codes reported when the system halt ?
features/FEATURE_BLE/source/BLE.cpp
Outdated
@@ -141,7 +141,7 @@ BLE::initImplementation(FunctionPointerWithContext<InitializationCompleteCallbac | |||
|
|||
// this stub is required by ARMCC otherwise link will systematically fail | |||
MBED_WEAK BLEInstanceBase* createBLEInstance() { | |||
error("Please provide an implementation for mbed BLE"); | |||
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_BLE, MBED_ERROR_CODE_BLE_NOT_IMPLEMENTED), "Please provide an implementation for mbed BLE"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that specific case I would use the error code CREATE_FAILED
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the error code to something like BLE_BACKEND_CREATION_FAILED
.
features/FEATURE_BLE/source/BLE.cpp
Outdated
@@ -191,7 +191,7 @@ void defaultSchedulingCallback(BLE::OnEventsToProcessCallbackContext* params) { | |||
bool BLE::hasInitialized(void) const | |||
{ | |||
if (!transport) { | |||
error("bad handle to underlying transport"); | |||
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_BLE, MBED_ERROR_CODE_BLE_BAD_TRANSPORT_HANDLE), "bad handle to underlying transport"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, I wold use a more generic INVALID_STATE
code or better a NOT_INITIALIZED
error code.
I would use the same code for all errors bellow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error code can be named BLE_BACKEND_NOT_INITIALIZED
. The term transport present in the code is incorrect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix that. Thanks.
8cd055d
to
5dc61bc
Compare
@pan- Mind re-reviewing? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@pan- Reminder that a re-review is waiting for you. |
@SenRamakri @cmonr I've updated my comments. |
Looks like this PR will be parked until @SenRamakri gets back from vacation week after next. |
5dc61bc
to
529af2b
Compare
@pan- - Error code names have been updated, please review. |
@pan- Mind taking a nother look? |
@donatieng ^^^ |
/morph build |
Build : SUCCESSBuild number : 2987 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 2595 |
Test : FAILUREBuild number : 2745 |
/morph test |
1 similar comment
/morph test |
Test : SUCCESSBuild number : 2750 |
Description
This is to update BLE error() calls to use the new error handler methods, this enables use of error codes, produces more informative error report and also enables use of error decoding tools like Mbed-Error microsite - https://armmbed.github.io/mbedos-error/
Pull request type