forked from oap-project/velox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
04c6074
commit 88538f2
Showing
4 changed files
with
80 additions
and
2 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
velox/external/date/patches/0005-add_error_type_for_invalid_timezone.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
diff --git a/velox/external/date/tz.cpp b/velox/external/date/tz.cpp | ||
index c3a3a8f7e..69513d7d3 100644 | ||
--- a/velox/external/date/tz.cpp | ||
+++ b/velox/external/date/tz.cpp | ||
@@ -3577,7 +3577,7 @@ tzdb::locate_zone(const std::string& tz_name) const | ||
return &*zi; | ||
} | ||
#endif // !USE_OS_TZDB | ||
- throw std::runtime_error(std::string(tz_name) + " not found in timezone database"); | ||
+ throw invalid_timezone(std::string(tz_name)); | ||
} | ||
return &*zi; | ||
} | ||
diff --git a/velox/external/date/tz.h b/velox/external/date/tz.h | ||
index a70bda4ad..c85b30eb7 100644 | ||
--- a/velox/external/date/tz.h | ||
+++ b/velox/external/date/tz.h | ||
@@ -284,6 +284,33 @@ ambiguous_local_time::make_msg(local_time<Duration> tp, const local_info& i) | ||
return os.str(); | ||
} | ||
|
||
+class invalid_timezone | ||
+ : public std::runtime_error | ||
+{ | ||
+public: | ||
+ invalid_timezone(const std::string tz_name); | ||
+ | ||
+private: | ||
+ static | ||
+ std::string | ||
+ make_msg(const std::string tz_name); | ||
+}; | ||
+ | ||
+inline | ||
+invalid_timezone::invalid_timezone(const std::string tz_name) | ||
+ : std::runtime_error(make_msg(tz_name)) | ||
+{ | ||
+} | ||
+ | ||
+inline | ||
+std::string | ||
+invalid_timezone::make_msg(const std::string tz_name) | ||
+{ | ||
+ std::ostringstream os; | ||
+ os << tz_name << " not found in timezone database"; | ||
+ return os.str(); | ||
+} | ||
+ | ||
class time_zone; | ||
|
||
#if HAS_STRING_VIEW |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters