Skip to content

Commit 4837cd1

Browse files
committed
Convert ParquetStatusException with OutOfMemory code to OutOfMemory exception
1 parent 7a83fdc commit 4837cd1

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

cpp/ExceptionInfo.h

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include <exception>
44
#include <string>
55

6+
#include <parquet/exception.h>
7+
68
struct ExceptionInfo final
79
{
810
ExceptionInfo(const char* type, const char* message);
@@ -14,23 +16,28 @@ struct ExceptionInfo final
1416
};
1517

1618
#define SINGLE_ARG(...) __VA_ARGS__
17-
#define TRYCATCH(expression) \
18-
try \
19-
{ \
20-
expression \
21-
return nullptr; \
22-
} \
23-
catch (const std::bad_alloc& exception) \
24-
{ \
25-
return new ExceptionInfo("OutOfMemoryException", exception.what()); \
26-
} \
27-
catch (const std::exception& exception) \
28-
{ \
29-
return new ExceptionInfo(exception); \
30-
} \
31-
catch (...) \
32-
{ \
33-
return new ExceptionInfo("unkown", "uncaught exception"); \
34-
} \
35-
19+
#define TRYCATCH(expression) \
20+
try \
21+
{ \
22+
expression \
23+
return nullptr; \
24+
} \
25+
catch (const std::bad_alloc& exception) \
26+
{ \
27+
return new ExceptionInfo("OutOfMemoryException", exception.what()); \
28+
} \
29+
catch (const parquet::ParquetStatusException& exception) \
30+
{ \
31+
return exception.status().IsOutOfMemory() \
32+
? new ExceptionInfo("OutOfMemoryException", exception.what()) \
33+
: new ExceptionInfo(exception); \
34+
} \
35+
catch (const std::exception& exception) \
36+
{ \
37+
return new ExceptionInfo(exception); \
38+
} \
39+
catch (...) \
40+
{ \
41+
return new ExceptionInfo("unknown", "uncaught exception"); \
42+
} \
3643

0 commit comments

Comments
 (0)