mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
Update error messages and error handling
This commit is contained in:
parent
d0776e5d2a
commit
ef7a66b542
@ -460,7 +460,8 @@ std::vector<std::string> LibArchiveReader::getAllFiles(NameFilter filter)
|
||||
void LibArchiveReader::setPassword([[maybe_unused]] const String & password_)
|
||||
{
|
||||
if (password_.empty())
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Can not set password to {} archive", archive_name);
|
||||
return;
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Cannot set password to {} archive", archive_name);
|
||||
}
|
||||
|
||||
LibArchiveReader::Handle LibArchiveReader::acquireHandle()
|
||||
|
@ -240,12 +240,12 @@ void LibArchiveWriter::finalize()
|
||||
finalized = true;
|
||||
}
|
||||
|
||||
void LibArchiveWriter::setCompression(const String & compression_method_, int compression_level)
|
||||
void LibArchiveWriter::setCompression(const String & compression_method_, int compression_level)
|
||||
{
|
||||
// throw an error unless setCompression is passed the default value
|
||||
if (compression_method_.empty() && compression_level == -1)
|
||||
return;
|
||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "tar archives are currently supported without compression");
|
||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Compressing tar archives is currently not supported");
|
||||
}
|
||||
|
||||
void LibArchiveWriter::setPassword([[maybe_unused]] const String & password_)
|
||||
|
@ -46,14 +46,12 @@ public:
|
||||
/// (Unless an error appeared and the archive is in fact no longer needed.)
|
||||
void finalize() override;
|
||||
|
||||
static constexpr const int kDefaultCompressionLevel = -1;
|
||||
|
||||
/// Sets compression method and level.
|
||||
/// Changing them will affect next file in the archive.
|
||||
void setCompression(const String & /* compression_method */, int /* compression_level */ = kDefaultCompressionLevel) override;
|
||||
void setCompression(const String & method, int level) override;
|
||||
|
||||
/// Sets password. If the password is not empty it will enable encryption in the archive.
|
||||
void setPassword(const String & /* password */) override;
|
||||
void setPassword(const String & password) override;
|
||||
|
||||
private:
|
||||
class WriteBufferFromLibArchive;
|
||||
|
@ -631,7 +631,7 @@ def test_tar_archive_with_bad_compression_method():
|
||||
|
||||
assert instance.query("SELECT count(), sum(x) FROM test.table") == "100\t4950\n"
|
||||
|
||||
expected_error = "tar archives are currenly supported without compression"
|
||||
expected_error = "Compressing tar archives is currently not supported"
|
||||
assert expected_error in instance.query_and_get_error(
|
||||
f"BACKUP TABLE test.table TO {backup_name} SETTINGS id='tar_archive_with_bad_compression_method', compression_method='foobar'"
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user