Skip to content

Commit d34f6fd

Browse files
amitkduttafacebook-github-bot
authored andcommitted
misc: Add External error source in VeloxException
Summary: Adding External error source category. These category of errors come from external systems (e.g. storage connectors, third party libraries). There are two cases: - External sources may have unique error codes. For example: In Meta internal distributed storage systems, there are error codes like FATAL_ERROR, LOCAL_THROTTLED, GLOBAL_THROTTLED) - External sources may have common error codes (e.g. user error or [unknown error code](https://github.com/facebookincubator/velox/blob/main/velox/dwio/common/exception/Exception.h#L185) that is common with Runtime errors. For service like Presto, external errors needs to identified by monitoring tools and customers to better classify system specific errors and inform external systems about there errors. Presto has [external error source](https://github.com/prestodb/presto/tree/6a455ac192c38f24b61d4c97f51ad36886ddec36/presto-common/src/main/java/com/facebook/presto/common#L22-L25) to uniquely idenitfy exteranl error codes. Adding `External` source to velox and using it from DWIO. It will also be used extensively for Meta internal uses cases to group storage specific error codes together and reporting to services like Presto. Differential Revision: D75491192
1 parent 80571bc commit d34f6fd

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

velox/common/base/VeloxException.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ inline constexpr auto kErrorSourceRuntime = "RUNTIME"_fs;
5353
/// Errors where the root cause of the problem is some unreliable aspect of the
5454
/// system are classified with source SYSTEM.
5555
inline constexpr auto kErrorSourceSystem = "SYSTEM"_fs;
56+
57+
/// Errors where the root cause of the problem is some external dependency (e.g.
58+
/// storage)
59+
inline constexpr auto kErrorSourceExternal = "EXTERNAL"_fs;
5660
} // namespace error_source
5761

5862
namespace error_code {

velox/dwio/common/exception/Exception.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class LoggedException : public velox::VeloxException {
5252
explicit LoggedException(
5353
const std::string& errorMessage,
5454
const std::string& errorSource =
55-
::facebook::velox::error_source::kErrorSourceRuntime,
55+
::facebook::velox::error_source::kErrorSourceExternal,
5656
const std::string& errorCode = ::facebook::velox::error_code::kUnknown,
5757
const bool isRetriable = false)
5858
: VeloxException(
@@ -181,15 +181,15 @@ containing information about the file, line, and function where it happened.
181181
#define DWIO_RAISE(...) \
182182
DWIO_EXCEPTION_CUSTOM( \
183183
facebook::velox::dwio::common::exception::LoggedException, \
184-
::facebook::velox::error_source::kErrorSourceRuntime, \
184+
::facebook::velox::error_source::kErrorSourceExternal, \
185185
::facebook::velox::error_code::kUnknown, \
186186
##__VA_ARGS__)
187187

188188
#define DWIO_ENSURE(expr, ...) \
189189
DWIO_ENFORCE_CUSTOM( \
190190
facebook::velox::dwio::common::exception::LoggedException, \
191191
expr, \
192-
::facebook::velox::error_source::kErrorSourceRuntime, \
192+
::facebook::velox::error_source::kErrorSourceExternal, \
193193
::facebook::velox::error_code::kUnknown, \
194194
##__VA_ARGS__)
195195

0 commit comments

Comments
 (0)