/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
library/cpp/yson_pull/exceptions.cpp
45 строк
1 KB
qkrorlqr
Initial NBS OpenSource export
28 апр 2023, 21:54
28 апр 2023, 21:54
783a858
Код
Авторство
О чём код?
#include "exceptions.h" #include <util/string/builder.h> #include <cerrno> #include <cstring> using namespace NYsonPull::NException; const char* TBadStream::what() const noexcept { TStringBuilder stream; stream << "Invalid YSON"; if (Position_.Offset || Position_.Line || Position_.Column) { bool first = true; stream << " at "; if (Position_.Offset) { stream << "offset " << *Position_.Offset; first = false; } if (Position_.Line) { if (!first) { stream << ", "; } stream << "line " << *Position_.Line; first = false; } if (Position_.Column) { if (!first) { stream << ", "; } stream << "column " << *Position_.Column; } } stream << ": " << Message_; FormattedMessage_ = stream; return FormattedMessage_.c_str(); } NYsonPull::NException::TSystemError::TSystemError() : SavedErrno_{errno} { } const char* NYsonPull::NException::TSystemError::what() const noexcept { return ::strerror(SavedErrno_); }