You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Michael Martell (Jira)" <ji...@apache.org> on 2020/10/07 15:57:00 UTC
[jira] [Assigned] (GEODE-8580) Improper use of throw in new C++
test framework
[ https://issues.apache.org/jira/browse/GEODE-8580?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Martell reassigned GEODE-8580:
--------------------------------------
Assignee: Michael Martell
Description:
The new C++ test framework (cppcache/integration/framework) throws pointers to exceptions. This is never a good idea. [https://stackoverflow.com/questions/10948316/throw-new-stdexception-vs-throw-stdexception]
Although you can catch pointers, it's not recommended practice.
Note: The particular error I ran into was in GfshExecute::execute, where
throw new GfshExecuteException("gfsh error", exit_code);
was being used. This requires gtest to use:
EXPECT_THROW(gfsh.query(query_stmt).execute(), GfshExecuteException*);
was:
The new C++ test framework (cppcache/integration/framework) throws pointers to exceptions. This is never a good idea. [https://stackoverflow.com/questions/10948316/throw-new-stdexception-vs-throw-stdexception]
Although you can catch pointers, it's not recommended practice.
Note: The particular error I ran into was in GfshExecute::execute, where
```
throw new GfshExecuteException("gfsh error", exit_code);
```
was being used. This requires gtest to use:
EXPECT_THROW(gfsh.query(query_stmt).execute(), GfshExecuteException*);
> Improper use of throw in new C++ test framework
> -----------------------------------------------
>
> Key: GEODE-8580
> URL: https://issues.apache.org/jira/browse/GEODE-8580
> Project: Geode
> Issue Type: Improvement
> Components: native client
> Reporter: Michael Martell
> Assignee: Michael Martell
> Priority: Major
>
> The new C++ test framework (cppcache/integration/framework) throws pointers to exceptions. This is never a good idea. [https://stackoverflow.com/questions/10948316/throw-new-stdexception-vs-throw-stdexception]
> Although you can catch pointers, it's not recommended practice.
> Note: The particular error I ran into was in GfshExecute::execute, where
> throw new GfshExecuteException("gfsh error", exit_code);
> was being used. This requires gtest to use:
> EXPECT_THROW(gfsh.query(query_stmt).execute(), GfshExecuteException*);
--
This message was sent by Atlassian Jira
(v8.3.4#803005)