Fastly Compute C++ SDK
Loading...
Searching...
No Matches
error.h
Go to the documentation of this file.
1#ifndef FASTLY_ERROR_H
2#define FASTLY_ERROR_H
3
4#include <fastly/expected.h>
5#include <fastly/sdk-sys.h>
6#include <string>
7
8namespace fastly::error {
9
10using fastly::sys::error::FastlyErrorCode;
11
13public:
14 FastlyError(fastly::sys::error::FastlyError *e)
15 : err(rust::Box<fastly::sys::error::FastlyError>::from_raw(e)) {};
16 FastlyError(rust::Box<fastly::sys::error::FastlyError> e)
17 : err(std::move(e)) {};
18 FastlyErrorCode error_code();
19 std::string error_msg();
20
21private:
22 rust::Box<fastly::sys::error::FastlyError> err;
23};
24
25template <class T> using expected = tl::expected<T, FastlyError>;
26template <class T> using unexpected = tl::unexpected<T>;
27
28} // namespace fastly::error
29
30namespace fastly {
33using fastly::error::FastlyErrorCode;
35} // namespace fastly
36
37#endif
Definition error.h:12
FastlyError(fastly::sys::error::FastlyError *e)
Definition error.h:14
FastlyError(rust::Box< fastly::sys::error::FastlyError > e)
Definition error.h:16
FastlyErrorCode error_code()
Definition error.h:8
tl::unexpected< T > unexpected
Definition error.h:26
tl::expected< T, FastlyError > expected
Definition error.h:25
Definition backend.h:13