diff options
| author | Fuwn <[email protected]> | 2024-05-31 00:00:12 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-05-31 00:20:41 -0700 |
| commit | 968e1c4af014b7f40bfaa4f57fcc0f38e5e0d847 (patch) | |
| tree | df80525ad0cc9e4b561bfb0772c30ccc5b64b4a2 /source/purchase_error.cc | |
| parent | feat: initial commit (diff) | |
| download | cst_136_assignment_eight-968e1c4af014b7f40bfaa4f57fcc0f38e5e0d847.tar.xz cst_136_assignment_eight-968e1c4af014b7f40bfaa4f57fcc0f38e5e0d847.zip | |
Diffstat (limited to 'source/purchase_error.cc')
| -rw-r--r-- | source/purchase_error.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/purchase_error.cc b/source/purchase_error.cc new file mode 100644 index 0000000..f9ae931 --- /dev/null +++ b/source/purchase_error.cc @@ -0,0 +1,21 @@ +#include <string_view> + +#include <book_store/purchase_error.hh> + +namespace book_store { +[[nodiscard]] auto +purchase_error::error() const noexcept -> purchase_error_type { + return this->_error; +} + +[[nodiscard]] auto purchase_error::what() const noexcept -> std::string_view { + switch (this->_error) { + case person_not_found: + return "Person not found"; + case book_not_found: + return "Book not found"; + case not_enough_stock: + return "Not enough stock"; + } +} +} // namespace book_store |