contur2
Loading...
Searching...
No Matches
error.h File Reference

Error codes and Result<T> type for fallible operations. More...

#include <cassert>
#include <cstdint>
#include <string_view>
#include <utility>
#include <variant>
Include dependency graph for error.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  contur::Result< T >
 A result type that holds either a success value of type T or an ErrorCode. More...
class  contur::Result< void >
 Specialization of Result for void — operations that produce no value on success. More...

Namespaces

namespace  contur

Enumerations

enum class  contur::ErrorCode : std::int32_t {
  contur::Ok = 0 , contur::OutOfMemory , contur::InvalidPid , contur::InvalidAddress ,
  contur::DivisionByZero , contur::InvalidInstruction , contur::SegmentationFault , contur::DeviceError ,
  contur::ProcessNotFound , contur::PermissionDenied , contur::Timeout , contur::DeadlockDetected ,
  contur::InvalidState , contur::InvalidArgument , contur::ResourceBusy , contur::NotFound ,
  contur::AlreadyExists , contur::BufferFull , contur::BufferEmpty , contur::EndOfFile ,
  contur::NotImplemented
}
 Error codes returned by kernel subsystem operations. More...

Functions

constexpr std::string_view contur::errorCodeToString (ErrorCode code) noexcept
 Returns a human-readable name for the given error code.

Detailed Description

Error codes and Result<T> type for fallible operations.

Result<T> is inspired by Rust's Result<T, E> — it holds either a success value of type T or an ErrorCode indicating what went wrong. A specialization Result<void> is provided for operations that produce no value on success.

Definition in file error.h.