mirror of
https://github.com/logos-co/logos-cpp-sdk.git
synced 2026-08-31 09:41:06 +00:00
codegen: CallError out-param instead of throwing wrappers
Per review, the generated sync wrappers expose the error channel as an optional trailing parameter — add(a, b, &err) — rather than throwing: explicit, stateless, works on temporaries, and existing call sites compile unchanged (they keep default-on-failure, now with a qWarning so failures are visible in the module log). The dispatch catch-all from the previous commit stays: it contains author exceptions, it doesn't introduce any.
This commit is contained in:
@@ -94,8 +94,8 @@ TEST(MakeHeaderTest, ContainsMethodDeclarations)
|
||||
QJsonArray methods = makeTestMethods();
|
||||
QString h = makeHeader("test_mod", "TestMod", methods);
|
||||
|
||||
EXPECT_TRUE(h.contains("int add(int a, int b)"));
|
||||
EXPECT_TRUE(h.contains("void reset()"));
|
||||
EXPECT_TRUE(h.contains("int add(int a, int b, logos::CallError* err = nullptr)"));
|
||||
EXPECT_TRUE(h.contains("void reset(logos::CallError* err = nullptr)"));
|
||||
// Non-invokable should not appear
|
||||
EXPECT_FALSE(h.contains("internal"));
|
||||
}
|
||||
@@ -197,7 +197,7 @@ TEST(MakeHeaderTest, QVariantListAsyncOverload)
|
||||
}
|
||||
|
||||
QString h = makeHeader("mod", "Mod", methods);
|
||||
EXPECT_TRUE(h.contains("QVariantList getItems()"));
|
||||
EXPECT_TRUE(h.contains("QVariantList getItems(logos::CallError* err = nullptr)"));
|
||||
EXPECT_TRUE(h.contains("getItemsAsync("));
|
||||
EXPECT_TRUE(h.contains("std::function<void(QVariantList)> callback"));
|
||||
}
|
||||
@@ -215,7 +215,7 @@ TEST(MakeHeaderTest, QVariantMapAsyncOverload)
|
||||
}
|
||||
|
||||
QString h = makeHeader("mod", "Mod", methods);
|
||||
EXPECT_TRUE(h.contains("QVariantMap getData()"));
|
||||
EXPECT_TRUE(h.contains("QVariantMap getData(logos::CallError* err = nullptr)"));
|
||||
EXPECT_TRUE(h.contains("getDataAsync("));
|
||||
EXPECT_TRUE(h.contains("std::function<void(QVariantMap)> callback"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user