-
Notifications
You must be signed in to change notification settings - Fork 670
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96d78f4
commit d5a16ab
Showing
1 changed file
with
75 additions
and
0 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
include/multipass/exceptions/availability_zone_exceptions.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright (C) Canonical, Ltd. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#ifndef MULTIPASS_AVAILABILITY_ZONE_EXCEPTIONS_H | ||
#define MULTIPASS_AVAILABILITY_ZONE_EXCEPTIONS_H | ||
|
||
#include <stdexcept> | ||
#include <string> | ||
|
||
#include <multipass/format.h> | ||
|
||
namespace multipass | ||
{ | ||
struct AvailabilityZoneError : std::runtime_error | ||
{ | ||
template <typename... Args> | ||
explicit AvailabilityZoneError(const char* fmt, Args&&... args) | ||
: runtime_error(fmt::format(fmt, std::forward<Args>(args)...)) | ||
{ | ||
} | ||
}; | ||
|
||
struct AvailabilityZoneSerializationError final : AvailabilityZoneError | ||
{ | ||
using AvailabilityZoneError::AvailabilityZoneError; | ||
}; | ||
|
||
struct AvailabilityZoneDeserializationError final : AvailabilityZoneError | ||
{ | ||
using AvailabilityZoneError::AvailabilityZoneError; | ||
}; | ||
|
||
struct AvailabilityZoneManagerError : std::runtime_error | ||
{ | ||
template <typename... Args> | ||
explicit AvailabilityZoneManagerError(const char* fmt, Args&&... args) | ||
: runtime_error(fmt::format(fmt, std::forward<Args>(args)...)) | ||
{ | ||
} | ||
}; | ||
|
||
struct AvailabilityZoneManagerSerializationError final : AvailabilityZoneManagerError | ||
{ | ||
using AvailabilityZoneManagerError::AvailabilityZoneManagerError; | ||
}; | ||
|
||
struct AvailabilityZoneManagerDeserializationError final : AvailabilityZoneManagerError | ||
{ | ||
using AvailabilityZoneManagerError::AvailabilityZoneManagerError; | ||
}; | ||
|
||
struct AvailabilityZoneNotFound final : AvailabilityZoneManagerError { | ||
explicit AvailabilityZoneNotFound(const std::string& name) : AvailabilityZoneManagerError{"no AZ with name {:?} found", name} {} | ||
}; | ||
|
||
struct NoAvailabilityZoneAvailable final : AvailabilityZoneManagerError { | ||
NoAvailabilityZoneAvailable() : AvailabilityZoneManagerError{"no AZ is available"} {} | ||
}; | ||
} // namespace multipass | ||
|
||
#endif // MULTIPASS_AVAILABILITY_ZONE_EXCEPTIONS_H |