diff options
author | udovichenko-r <[email protected]> | 2023-08-21 18:01:50 +0300 |
---|---|---|
committer | udovichenko-r <[email protected]> | 2023-08-21 18:21:20 +0300 |
commit | 6a0b4a255c58b2b5f8e5b999200c090d9120b227 (patch) | |
tree | 5fca901244e81d4240872b68bfbb9ef82bf7bc5e | |
parent | 8f953a0df86adb6c305daaa7fd5b095aa1eada3d (diff) |
[dq] Short partition error message
YQL-16107
3 files changed, 15 insertions, 11 deletions
diff --git a/ydb/library/yql/providers/yt/gateway/lib/yt_helpers.cpp b/ydb/library/yql/providers/yt/gateway/lib/yt_helpers.cpp index 13dbab139ad..6ed2dcb3a77 100644 --- a/ydb/library/yql/providers/yt/gateway/lib/yt_helpers.cpp +++ b/ydb/library/yql/providers/yt/gateway/lib/yt_helpers.cpp @@ -570,8 +570,10 @@ void CreateParents(const TVector<TString>& tables, NYT::IClientBasePtr tx) { } } -static void FillResultFromOperationError(NCommon::TOperationResult& result, const NYT::TOperationFailedError& e, TPosition pos) { - TString errMsg = GetEnv("YQL_DETERMINISTIC_MODE") ? e.GetError().ShortDescription() : TString(e.what()); +namespace { + +void FillResultFromOperationError(NCommon::TOperationResult& result, const NYT::TOperationFailedError& e, TPosition pos, bool shortErrors) { + TString errMsg = shortErrors || GetEnv("YQL_DETERMINISTIC_MODE") ? e.GetError().ShortDescription() : TString(e.what()); EYqlIssueCode rootIssueCode = IssueCodeForYtError(e.GetError()); TIssue rootIssue = YqlIssue(pos, rootIssueCode, errMsg); @@ -597,8 +599,8 @@ static void FillResultFromOperationError(NCommon::TOperationResult& result, cons result.AddIssue(rootIssue); } -static void FillResultFromErrorResponse(NCommon::TOperationResult& result, const NYT::TErrorResponse& e, TPosition pos) { - TString errMsg = GetEnv("YQL_DETERMINISTIC_MODE") ? e.GetError().ShortDescription() : TString(e.what()); +void FillResultFromErrorResponse(NCommon::TOperationResult& result, const NYT::TErrorResponse& e, TPosition pos, bool shortErrors) { + TString errMsg = shortErrors || GetEnv("YQL_DETERMINISTIC_MODE") ? e.GetError().ShortDescription() : TString(e.what()); EYqlIssueCode rootIssueCode = IssueCodeForYtError(e.GetError()); TIssue rootIssue = YqlIssue(pos, rootIssueCode, errMsg); @@ -607,13 +609,15 @@ static void FillResultFromErrorResponse(NCommon::TOperationResult& result, const result.AddIssue(rootIssue); } -void FillResultFromCurrentException(NCommon::TOperationResult& result, TPosition pos) { +} // unnamed + +void FillResultFromCurrentException(NCommon::TOperationResult& result, TPosition pos, bool shortErrors) { try { throw; } catch (const NYT::TOperationFailedError& e) { - FillResultFromOperationError(result, e, pos); + FillResultFromOperationError(result, e, pos, shortErrors); } catch (const NYT::TErrorResponse& e) { - FillResultFromErrorResponse(result, e, pos); + FillResultFromErrorResponse(result, e, pos, shortErrors); } catch (const std::exception& e) { result.SetException(e, pos); } catch (const NKikimr::TMemoryLimitExceededException&) { diff --git a/ydb/library/yql/providers/yt/gateway/lib/yt_helpers.h b/ydb/library/yql/providers/yt/gateway/lib/yt_helpers.h index f36a93abb27..151399ede76 100644 --- a/ydb/library/yql/providers/yt/gateway/lib/yt_helpers.h +++ b/ydb/library/yql/providers/yt/gateway/lib/yt_helpers.h @@ -53,13 +53,13 @@ NYT::TNode YqlOpOptionsToAttrs(const TYqlOperationOptions& opOpts); void CreateParents(const TVector<TString>& tables, NYT::IClientBasePtr tx); // must be used inside 'catch' because it rethrows current exception to analyze it's type -void FillResultFromCurrentException(NCommon::TOperationResult& result, TPosition pos = {}); +void FillResultFromCurrentException(NCommon::TOperationResult& result, TPosition pos = {}, bool shortErrors = false); // must be used inside 'catch' because it rethrows current exception to analyze it's type template<typename TResult> -static TResult ResultFromCurrentException(TPosition pos = {}) { +static TResult ResultFromCurrentException(TPosition pos = {}, bool shortErrors = false) { TResult result; - FillResultFromCurrentException(result, pos); + FillResultFromCurrentException(result, pos, shortErrors); return result; } diff --git a/ydb/library/yql/providers/yt/gateway/native/yql_yt_native.cpp b/ydb/library/yql/providers/yt/gateway/native/yql_yt_native.cpp index 021a3e90332..7b7870f7897 100644 --- a/ydb/library/yql/providers/yt/gateway/native/yql_yt_native.cpp +++ b/ydb/library/yql/providers/yt/gateway/native/yql_yt_native.cpp @@ -1178,7 +1178,7 @@ public: res.SetSuccess(); return res; } catch (...) { - return ResultFromCurrentException<TGetTablePartitionsResult>(); + return ResultFromCurrentException<TGetTablePartitionsResult>({}, true); } } |