Explicit error message for all errors.
- added for passthrough oneway queue filling up
- added for null sync callback
- added test for null sync callback since it didn't exist
Test: hidl_test
Bug: 62713128
Change-Id: Ib9d3080aaf51161344e67b806babcb6fb45419ec
diff --git a/generateCpp.cpp b/generateCpp.cpp
index 9f07fdc..04033a7 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -1160,7 +1160,8 @@
out.sIf(nonNull + " == nullptr", [&] {
out << "return ::android::hardware::Status::fromExceptionCode(\n";
out.indent(2, [&] {
- out << "::android::hardware::Status::EX_ILLEGAL_ARGUMENT);\n";
+ out << "::android::hardware::Status::EX_ILLEGAL_ARGUMENT,\n"
+ << "\"Null synchronous callback passed.\");\n";
});
}).endl().endl();
}
@@ -1984,7 +1985,8 @@
out << "return ::android::hardware::Status::fromExceptionCode(\n";
out.indent();
out.indent();
- out << "::android::hardware::Status::EX_TRANSACTION_FAILED);\n";
+ out << "::android::hardware::Status::EX_TRANSACTION_FAILED,\n"
+ << "\"Passthrough oneway function queue exceeds maximum size.\");\n";
out.unindent();
out.unindent();
out.unindent();
diff --git a/test/hidl_test_client.cpp b/test/hidl_test_client.cpp
index 40d63f9..75fc633 100644
--- a/test/hidl_test_client.cpp
+++ b/test/hidl_test_client.cpp
@@ -1190,6 +1190,13 @@
}));
}
+TEST_F(HidlTest, FooNullSynchronousCallbackTest) {
+ Return<void> ret = foo->echoNullInterface(nullptr, nullptr /* synchronous callback */);
+
+ EXPECT_FAIL(ret);
+ EXPECT_TRUE(ret.description().find("Null synchronous callback passed") != std::string::npos);
+}
+
TEST_F(HidlTest, FooNullCallbackTest) {
EXPECT_OK(foo->echoNullInterface(nullptr,
[](const auto receivedNull, const auto &intf) {