Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix exceptions with message: unknown exception type; no further information. #5080

Merged
merged 3 commits into from
Jun 17, 2024

Conversation

DimitrisStaratzis
Copy link
Contributor

@DimitrisStaratzis DimitrisStaratzis commented Jun 12, 2024

This PR migrates from throw Status_*Error() to throw *Exception(). This was causing some exceptions to be silenced because the previous implementation was not handling them correctly resulting in the display of the generic error message: unknown exception type; no further information

To achieve this migration I had to create the following Exception classes: FragmentInfoException, QueryConditionException, ArraySchemaSerializationDisabledException, ArraySchemaSerializationException, ConsolidationSerializationDisabledException, ConsolidationSerializationException, EnumerationSerializationDisabledException, EnumerationSerializationException, QueryPlanSerializationDisabledException, QueryPlanSerializationException

[sc-48757]


TYPE: BUG
DESC: Fix exceptions with message: unknown exception type; no further information.

@DimitrisStaratzis DimitrisStaratzis changed the title Fix exceptions with message unknown exception type; no further information. Fix exceptions with message: unknown exception type; no further information. Jun 12, 2024
@@ -338,26 +339,22 @@ QueryPlan deserialize_query_plan_response(

void serialize_query_plan_request(
const Config&, Query&, const SerializationType, Buffer&) {
throw Status_SerializationError(
"Cannot serialize; serialization not enabled.");
throw GenericException("Cannot serialize; serialization not enabled.");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason this is a GenericException and not a SerializationStatusException is because the SerializationStatusException class is excluded from the preprocessor when building with serialization off. So we raise a GenericException which is defined in util.h

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should define class SerializationDisabledException to use in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I defined QueryPlanSerializationDisabledException so that we are more precise and follow what happens in other classes like Array as you mentioned

@DimitrisStaratzis DimitrisStaratzis marked this pull request as ready for review June 12, 2024 17:30
Copy link
Contributor

@eric-hughes-tiledb eric-hughes-tiledb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class GenericException should be replaced with something much more specific. See comments.

I'd prefer seeing an alias using SerializationException = SerializationStatusException so that we don't add all those legacy identifiers to the code.

Otherwise looks good.

@@ -46,6 +46,14 @@
namespace tiledb {
namespace sm {

/** Class for generic status exceptions. */
class GenericException : public StatusException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to use this. Calling a StatusException generic requires subverting the requirement that we track origin.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Comment on lines 49 to 56
/** Class for generic status exceptions. */
class GenericException : public StatusException {
public:
explicit GenericException(const std::string& msg)
: StatusException("Generic", msg) {
}
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Class for generic status exceptions. */
class GenericException : public StatusException {
public:
explicit GenericException(const std::string& msg)
: StatusException("Generic", msg) {
}
};

@@ -2081,26 +2082,22 @@ Status max_buffer_sizes_deserialize(

void serialize_load_array_schema_request(
const Config&, const LoadArraySchemaRequest&, SerializationType, Buffer&) {
throw Status_SerializationError(
"Cannot serialize; serialization not enabled.");
throw GenericException("Cannot serialize; serialization not enabled.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this exception see, for example, class ArraySerializationDisabledException. We should use the analogous technique here.

I'm not sure we need an exception type for each kind of object being serialized. I'd be good with a single SerializationDisabledException with origin serialization.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not want to deviate from the already used techniques so I created all the necessary *DisabledException classes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created all the necessary *DisabledException classes

That's fine too.

@@ -338,26 +339,22 @@ QueryPlan deserialize_query_plan_response(

void serialize_query_plan_request(
const Config&, Query&, const SerializationType, Buffer&) {
throw Status_SerializationError(
"Cannot serialize; serialization not enabled.");
throw GenericException("Cannot serialize; serialization not enabled.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should define class SerializationDisabledException to use in this case.

Copy link
Contributor

@eric-hughes-tiledb eric-hughes-tiledb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@KiterLuc KiterLuc merged commit d32d9af into dev Jun 17, 2024
63 checks passed
@KiterLuc KiterLuc deleted the dstara/fix_unknown_capi_exceptions branch June 17, 2024 09:13
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants