summaryrefslogtreecommitdiff
path: root/source/purchase_error.cc
blob: f9ae931af35e88dd2b9ac0c0fb9bb006f46ad36a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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