[
https://issues.apache.org/jira/browse/ARROW-4036?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16723102#comment-16723102
]
Benjamin Kietzman edited comment on ARROW-4036 at 12/17/18 3:59 PM:
--------------------------------------------------------------------
We could use the status range and the error code within it to get something
similar:
{code:java}
enum GandivaErrorCode : int32_t {
CodeGenError,
//...
};
static StatusRange GandivaError("gandiva", {
"CodeGenError",
//...
});
Status MakeCodeGenError() {
return GandivaError(CodeGenError, "msg"); // overload call operator to act as
a factory
}
void QueryUsage(Status s) {
s.Is<GandivaError>(); // query category
s.Is<GandivaError, CodeGenError>(); // query code within category
// or equivalently
s.Is(GandivaError); // query category
s.Is(GandivaError, CodeGenError); // query code within category
}{code}
was (Author: bkietz):
We could use the status range and the error code within it to get something
similar:
{code:java}
enum GandivaErrorCode : int32_t {
CodeGenError,
//...
};
string_view GandivaErrorMessages[] = {
"CodeGenError",
//...
};
static StatusRange GandivaError("gandiva", GandivaErrorMessages);
Status MakeCodeGenError() {
return GandivaError(CodeGenError, "msg"); // overload call operator to act as
a factory
}
void QueryUsage(Status s) {
s.Is<GandivaError>(); // query category
s.Is<GandivaError, CodeGenError>(); // query code within category
// or equivalently
s.Is(GandivaError); // query category
s.Is(GandivaError, CodeGenError); // query code within category
}{code}
> [C++] Make status codes pluggable
> ---------------------------------
>
> Key: ARROW-4036
> URL: https://issues.apache.org/jira/browse/ARROW-4036
> Project: Apache Arrow
> Issue Type: Improvement
> Components: C++
> Affects Versions: 0.11.1
> Reporter: Antoine Pitrou
> Priority: Major
> Labels: pull-request-available
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Currently we're defining all Status codes in the Arrow base library, even
> those pertaining to sub-libraries such as arrow_python, plasma, gandiva, etc.
> We should try to devise some kind of simple registry system to avoid
> centralizing those.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)