summaryrefslogtreecommitdiff
path: root/include/book_store/purchase_error.hh
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-05-31 00:00:12 -0700
committerFuwn <[email protected]>2024-05-31 00:20:41 -0700
commit968e1c4af014b7f40bfaa4f57fcc0f38e5e0d847 (patch)
treedf80525ad0cc9e4b561bfb0772c30ccc5b64b4a2 /include/book_store/purchase_error.hh
parentfeat: initial commit (diff)
downloadcst_136_assignment_eight-main.tar.xz
cst_136_assignment_eight-main.zip
feat: final releaseHEADmain
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