exceptions.cpp 899 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include "exceptions.h"
  2. #include <util/string/builder.h>
  3. namespace NYql {
  4. TCodeLineException::TCodeLineException(ui32 code)
  5. : SourceLocation("", 0)
  6. , Code(code)
  7. {}
  8. TCodeLineException::TCodeLineException(const TSourceLocation& sl, const TCodeLineException& t)
  9. : yexception(t)
  10. , SourceLocation(sl)
  11. , Code(t.Code)
  12. {}
  13. const char* TCodeLineException::GetRawMessage() const {
  14. return yexception::what();
  15. }
  16. const char* TCodeLineException::what() const noexcept {
  17. try {
  18. if (!Message) {
  19. Message = TStringBuilder{} << SourceLocation << TStringBuf(": ") << yexception::what();
  20. }
  21. return Message.c_str();
  22. } catch(...) {
  23. return "Unexpected exception in TCodeLineException::what()";
  24. }
  25. }
  26. TCodeLineException operator+(const TSourceLocation& sl, TCodeLineException&& t) {
  27. return TCodeLineException(sl, t);
  28. }
  29. } // namespace NFq