Expound on HIDL Return errors.
Add 'onValueRetrieval' error which explicitly talks about the error
being while retrieving a value (since 'assertOk' was publically
exposed, it no longer makes sense to have a specific error).
assertOk is now also used in ~return_status and contains even more
information about how to interpret the error.
Bug: many
Test: TH
Change-Id: I80a7ec2ae42b7980a0a84fc760d5b27b17f293db
diff --git a/base/include/hidl/Status.h b/base/include/hidl/Status.h
index 817277f..07d352f 100644
--- a/base/include/hidl/Status.h
+++ b/base/include/hidl/Status.h
@@ -143,6 +143,8 @@
template <typename T, typename U>
friend Return<U> StatusOf(const Return<T> &other);
+ protected:
+ void onValueRetrieval() const;
public:
void assertOk() const;
return_status() {}
@@ -224,7 +226,7 @@
~Return() = default;
operator T() const {
- assertOk();
+ onValueRetrieval(); // assert okay
return mVal;
}
@@ -253,7 +255,7 @@
~Return() = default;
operator sp<T>() const {
- assertOk();
+ onValueRetrieval(); // assert okay
return mVal;
}