exceptions.cpp

 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <felspar/coro/exception.details.hpp>
#include <felspar/exceptions/runtime_error.hpp>
#include <felspar/exceptions/logic_error.hpp>

#include <stdexcept>


void felspar::coro::detail::throw_task_not_completed(
        std::source_location const &loc) {
    throw felspar::stdexcept::runtime_error{"The task hasn't completed", loc};
}


void felspar::coro::detail::throw_task_not_completed_with_value(
        std::source_location const &loc) {
    throw felspar::stdexcept::runtime_error{
            "The task hasn't completed with a value ", loc};
}


void felspar::coro::detail::throw_task_empty(std::source_location const &loc) {
    throw felspar::stdexcept::runtime_error{"Cannot start an empty task", loc};
}


void felspar::coro::detail::throw_future_no_value(
        std::source_location const &loc) {
    throw felspar::stdexcept::logic_error{
            "Future does not contain a value", loc};
}


void felspar::coro::detail::throw_future_already_set(
        std::source_location const &loc) {
    throw felspar::stdexcept::logic_error{
            "The future already has a value set", loc};
}


void felspar::coro::detail::throw_starter_no_items(
        std::source_location const &loc) {
    throw felspar::stdexcept::logic_error{
            "Cannot call starter::next() if there are no items", loc};
}