blob: 718ca4622e3bc47ff7824734ec0b9d042c5c9e9d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#ifndef PURCHASE_ERROR_HH
#define PURCHASE_ERROR_HH
#include <string_view>
namespace book_store {
class purchase_error {
public:
enum purchase_error_type {
person_not_found,
book_not_found,
not_enough_stock,
};
private:
purchase_error_type _error;
public:
purchase_error(purchase_error_type error) : _error(error) {}
[[nodiscard]] auto error() const noexcept -> purchase_error_type;
[[nodiscard]] auto what() const noexcept -> std::string_view;
};
} // namespace book_store
#endif // PURCHASE_ERROR_HH
|