Files
scylladb/compaction/exceptions.hh
Botond Dénes 9c85046f93 sstables,compaction: move compaction exceptions to compaction/
sstables/exceptions.hh still hosts some compaction specific exception
types. Move them over to the new compaction/exceptions.hh, to make the
compaction module more self-contained.
2025-09-29 06:49:14 +03:00

45 lines
1.2 KiB
C++

/*
* Copyright (C) 2025-present ScyllaDB
*
*/
/*
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#pragma once
#include <seastar/core/format.hh>
#include <exception>
#include "seastarx.hh"
namespace compaction {
class compaction_job_exception : public std::exception {
sstring _msg;
public:
compaction_job_exception(sstring msg) noexcept : _msg(std::move(msg)) {}
const char *what() const noexcept {
return _msg.c_str();
}
};
// Indicates that compaction was stopped via an external event,
// E.g. shutdown or api call.
class compaction_stopped_exception : public compaction_job_exception {
public:
compaction_stopped_exception(sstring ks, sstring cf, sstring reason)
: compaction_job_exception(format("Compaction for {}/{} was stopped due to: {}", ks, cf, reason)) {}
};
// Indicates that compaction hit an unrecoverable error
// and should be aborted.
class compaction_aborted_exception : public compaction_job_exception {
public:
compaction_aborted_exception(sstring ks, sstring cf, sstring reason)
: compaction_job_exception(format("Compaction for {}/{} was aborted due to: {}", ks, cf, reason)) {}
};
} // namespace compaction