summaryrefslogtreecommitdiff
path: root/include/book_store/purchase_error.hh
diff options
context:
space:
mode:
Diffstat (limited to 'include/book_store/purchase_error.hh')
-rw-r--r--include/book_store/purchase_error.hh26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/book_store/purchase_error.hh b/include/book_store/purchase_error.hh
new file mode 100644
index 0000000..718ca46
--- /dev/null
+++ b/include/book_store/purchase_error.hh
@@ -0,0 +1,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