aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/utils/exceptions.cpp
blob: 8a6d09fc9d19b10d3462e628a9641f67c803ded9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "exceptions.h"

#include <util/string/builder.h>

namespace NYql {

TCodeLineException::TCodeLineException(ui32 code)
    : SourceLocation("", 0)
    , Code(code)
{}

TCodeLineException::TCodeLineException(const TSourceLocation& sl, const TCodeLineException& t)
    : yexception(t)
    , SourceLocation(sl)
    , Code(t.Code)
{}

const char* TCodeLineException::GetRawMessage() const {
    return yexception::what();
}

const char* TCodeLineException::what() const noexcept {
    try {
        if (!Message) {
            Message = TStringBuilder{} << SourceLocation << TStringBuf(": ") << yexception::what();
        }
        return Message.c_str();
    } catch(...) {
        return "Unexpected exception in TCodeLineException::what()";
    }
}

TCodeLineException operator+(const TSourceLocation& sl, TCodeLineException&& t) {
    return TCodeLineException(sl, t);
}

} // namespace NFq