11#include " xz.h"
22
33#include < util/generic/size_literals.h>
4+ #include < ydb/library/yql/utils/exceptions.h>
45#include < ydb/library/yql/utils/yql_panic.h>
56#include " output_queue_impl.h"
67
@@ -18,11 +19,11 @@ TReadBuffer::TReadBuffer(NDB::ReadBuffer& source)
1819 case LZMA_OK:
1920 return ;
2021 case LZMA_MEM_ERROR:
21- throw yexception ( ) << " Memory allocation failed." ;
22+ throw TCodeLineException (TIssuesIds::UNEXPECTED ) << " Memory allocation failed." ;
2223 case LZMA_OPTIONS_ERROR:
23- throw yexception ( ) << " Unsupported decompressor flags." ;
24+ throw TCodeLineException (TIssuesIds::KIKIMR_BAD_REQUEST ) << " Unsupported decompressor flags." ;
2425 default :
25- throw yexception ( ) << " Unknown error << " << int (ret) << " , possibly a bug." ;
26+ throw TCodeLineException (TIssuesIds::UNEXPECTED ) << " Unknown error << " << int (ret) << " , possibly a bug." ;
2627 }
2728}
2829
@@ -70,17 +71,17 @@ bool TReadBuffer::nextImpl() {
7071 case LZMA_OK:
7172 continue ;
7273 case LZMA_MEM_ERROR:
73- throw yexception ( ) << " Memory allocation failed." ;
74+ throw TCodeLineException (TIssuesIds::UNEXPECTED ) << " Memory allocation failed." ;
7475 case LZMA_FORMAT_ERROR:
75- throw yexception ( ) << " The input is not in the .xz format." ;
76+ throw TCodeLineException (TIssuesIds::KIKIMR_BAD_REQUEST ) << " The input is not in the .xz format." ;
7677 case LZMA_OPTIONS_ERROR:
77- throw yexception ( ) << " Unsupported compression options." ;
78+ throw TCodeLineException (TIssuesIds::KIKIMR_BAD_REQUEST ) << " Unsupported compression options." ;
7879 case LZMA_DATA_ERROR:
79- throw yexception ( ) << " Compressed file is corrupt." ;
80+ throw TCodeLineException (TIssuesIds::KIKIMR_BAD_REQUEST ) << " Compressed file is corrupt." ;
8081 case LZMA_BUF_ERROR:
81- throw yexception ( ) << " Compressed file is truncated or otherwise corrupt." ;
82+ throw TCodeLineException (TIssuesIds::KIKIMR_BAD_REQUEST ) << " Compressed file is truncated or otherwise corrupt." ;
8283 default :
83- throw yexception ( ) << " Unknown error " << int (ret) << " , possibly a bug." ;
84+ throw TCodeLineException (TIssuesIds::UNEXPECTED ) << " Unknown error " << int (ret) << " , possibly a bug." ;
8485 }
8586 }
8687}
@@ -95,7 +96,7 @@ class TCompressor : public TOutputQueue<> {
9596 // options for further compression
9697 lzma_options_lzma opt_lzma2;
9798 if (lzma_lzma_preset (&opt_lzma2, level))
98- throw yexception ( ) << " lzma preset failed: lzma version: " << LZMA_VERSION_STRING;
99+ throw TCodeLineException (TIssuesIds::UNEXPECTED ) << " lzma preset failed: lzma version: " << LZMA_VERSION_STRING;
99100
100101 lzma_filter filters[] = {
101102 {.id = LZMA_FILTER_X86, .options = nullptr },
@@ -107,11 +108,11 @@ class TCompressor : public TOutputQueue<> {
107108 case LZMA_OK:
108109 return ;
109110 case LZMA_MEM_ERROR:
110- throw yexception ( ) << " Memory allocation failed." ;
111+ throw TCodeLineException (TIssuesIds::UNEXPECTED ) << " Memory allocation failed." ;
111112 case LZMA_OPTIONS_ERROR:
112- throw yexception ( ) << " Unsupported decompressor flags." ;
113+ throw TCodeLineException (TIssuesIds::KIKIMR_BAD_REQUEST ) << " Unsupported decompressor flags." ;
113114 default :
114- throw yexception ( ) << " Unknown error << " << int (ret) << " , possibly a bug." ;
115+ throw TCodeLineException (TIssuesIds::UNEXPECTED ) << " Unknown error << " << int (ret) << " , possibly a bug." ;
115116 }
116117 }
117118
@@ -168,17 +169,17 @@ class TCompressor : public TOutputQueue<> {
168169 case LZMA_STREAM_END:
169170 return TOutputQueue::Seal ();
170171 case LZMA_MEM_ERROR:
171- throw yexception ( ) << " Memory allocation failed." ;
172+ throw TCodeLineException (TIssuesIds::UNEXPECTED ) << " Memory allocation failed." ;
172173 case LZMA_FORMAT_ERROR:
173- throw yexception ( ) << " The input is not in the .xz format." ;
174+ throw TCodeLineException (TIssuesIds::KIKIMR_BAD_REQUEST ) << " The input is not in the .xz format." ;
174175 case LZMA_OPTIONS_ERROR:
175- throw yexception ( ) << " Unsupported compression options." ;
176+ throw TCodeLineException (TIssuesIds::KIKIMR_BAD_REQUEST ) << " Unsupported compression options." ;
176177 case LZMA_DATA_ERROR:
177- throw yexception ( ) << " Compressed file is corrupt." ;
178+ throw TCodeLineException (TIssuesIds::KIKIMR_BAD_REQUEST ) << " Compressed file is corrupt." ;
178179 case LZMA_BUF_ERROR:
179- throw yexception ( ) << " Compressed file is truncated or otherwise corrupt." ;
180+ throw TCodeLineException (TIssuesIds::KIKIMR_BAD_REQUEST ) << " Compressed file is truncated or otherwise corrupt." ;
180181 default :
181- throw yexception ( ) << " Unknown error " << int (ret) << " , possibly a bug." ;
182+ throw TCodeLineException (TIssuesIds::UNEXPECTED ) << " Unknown error " << int (ret) << " , possibly a bug." ;
182183 }
183184 };
184185 }
0 commit comments