Skip to content

Commit

Permalink
Refactored TYQLConclusionStatusImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigoriyPA committed Dec 10, 2024
1 parent d2b36a6 commit 1364137
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
18 changes: 9 additions & 9 deletions ydb/library/conclusion/generic/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,21 @@ class TConclusionStatusImpl : public TConclusionStatusGenericImpl<TStatus, Statu
};

template <class TStatus, TStatus StatusOk, TStatus DefaultError>
class TConclusionStatusIssueImpl : public TConclusionStatusGenericImpl<TStatus, StatusOk, DefaultError, NYql::TIssues, TConclusionStatusIssueImpl<TStatus, StatusOk, DefaultError>> {
class TYQLConclusionStatusImpl : public TConclusionStatusGenericImpl<TStatus, StatusOk, DefaultError, NYql::TIssues, TYQLConclusionStatusImpl<TStatus, StatusOk, DefaultError>> {
protected:
friend class TConclusionStatusGenericImpl<TStatus, StatusOk, DefaultError, NYql::TIssues, TConclusionStatusIssueImpl<TStatus, StatusOk, DefaultError>>;
friend class TConclusionStatusGenericImpl<TStatus, StatusOk, DefaultError, NYql::TIssues, TYQLConclusionStatusImpl<TStatus, StatusOk, DefaultError>>;

using TBase = TConclusionStatusGenericImpl<TStatus, StatusOk, DefaultError, NYql::TIssues, TConclusionStatusIssueImpl<TStatus, StatusOk, DefaultError>>;
using TBase = TConclusionStatusGenericImpl<TStatus, StatusOk, DefaultError, NYql::TIssues, TYQLConclusionStatusImpl<TStatus, StatusOk, DefaultError>>;
using TBase::TBase;

TConclusionStatusIssueImpl() = default;
TYQLConclusionStatusImpl() = default;

TConclusionStatusIssueImpl(const TString& errorMessage, TStatus status = DefaultError)
TYQLConclusionStatusImpl(const TString& errorMessage, TStatus status = DefaultError)
: TBase({NYql::TIssue(errorMessage)}, status) {
}

public:
TConclusionStatusIssueImpl& AddParentIssue(NYql::TIssue issue) {
TYQLConclusionStatusImpl& AddParentIssue(NYql::TIssue issue) {
Y_ABORT_UNLESS(!!TBase::ErrorMessage);
for (const auto& childIssue : *TBase::ErrorMessage) {
issue.AddSubIssue(MakeIntrusive<NYql::TIssue>(childIssue));
Expand All @@ -130,18 +130,18 @@ class TConclusionStatusIssueImpl : public TConclusionStatusGenericImpl<TStatus,
return *this;
}

TConclusionStatusIssueImpl& AddParentIssue(const TString& message) {
TYQLConclusionStatusImpl& AddParentIssue(const TString& message) {
AddParentIssue(NYql::TIssue(message));
return *this;
}

TConclusionStatusIssueImpl& AddIssue(NYql::TIssue issue) {
TYQLConclusionStatusImpl& AddIssue(NYql::TIssue issue) {
Y_ABORT_UNLESS(!!TBase::ErrorMessage);
TBase::ErrorMessage->AddIssue(std::move(issue));
return *this;
}

TConclusionStatusIssueImpl& AddIssue(const TString& message) {
TYQLConclusionStatusImpl& AddIssue(const TString& message) {
AddIssue(NYql::TIssue(message));
return *this;
}
Expand Down
3 changes: 3 additions & 0 deletions ydb/library/conclusion/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ using TConclusionStatus = TConclusionStatusImpl<::TNull, ::TNull{}, ::TNull{}>;
template <class TStatus, TStatus StatusOk, TStatus DefaultError>
using TConclusionSpecialStatus = TConclusionStatusImpl<TStatus, StatusOk, DefaultError>;

template <class TStatus, TStatus StatusOk, TStatus DefaultError>
using TYQLConclusionSpecialStatus = TYQLConclusionStatusImpl<TStatus, StatusOk, DefaultError>;

}

0 comments on commit 1364137

Please sign in to comment.