Better error message when hidl call fails.
Now when a return object !isOk and is not checked, the error message
includes the description of the return object. This way, error codes are
exposed in logs on the device.
Test: hidl_test
Change-Id: Id886342d1d78297c3aa8301d565b48e4374665ee
diff --git a/base/include/hidl/Status.h b/base/include/hidl/Status.h
index 1be818d..13f0c2c 100644
--- a/base/include/hidl/Status.h
+++ b/base/include/hidl/Status.h
@@ -21,7 +21,6 @@
#include <sstream>
#include <android-base/macros.h>
-#include <hidl/HidlInternal.h>
#include <utils/Errors.h>
#include <utils/StrongPointer.h>
@@ -143,29 +142,19 @@
std::ostream& operator<< (std::ostream& stream, const Status& s);
namespace details {
- class return_status : public details::hidl_log_base {
+ class return_status {
private:
Status mStatus {};
mutable bool mCheckedStatus = false;
protected:
- void checkStatus() const {
- if (!isOk()) {
- logAlwaysFatal("Attempted to retrieve value from hidl service, "
- "but there was a transport error.");
- }
- }
+ void checkStatus() const;
public:
return_status() {}
return_status(Status s) : mStatus(s) {}
return_status(const return_status &) = default;
- ~return_status() {
- // mCheckedStatus must be checked before isOk since isOk modifies mCheckedStatus
- if (!mCheckedStatus && !isOk()) {
- logAlwaysFatal("HIDL return status not checked and transport error occured.");
- }
- }
+ ~return_status();
bool isOk() const {
mCheckedStatus = true;