AngouriMath
ErrorCode.h
1 #pragma once
2 
3 #include <string>
4 #include "TypeAliases.h"
5 
6 namespace AngouriMath
7 {
8  struct ErrorCode
9  {
10  public:
11  ErrorCode() { }
12 
13  ErrorCode(std::string name, std::string message, std::string stackTrace)
14  : name(std::move(name)), message(std::move(message)), stackTrace(std::move(stackTrace)) { }
15 
16  bool IsOk() const { return this->name.empty(); }
17  const std::string& Name() const { return this->name; }
18  const std::string& Message() const { return this->message; }
19  const std::string& StackTrace() const { return this->stackTrace; }
20  private:
21  std::string name;
22  std::string message;
23  std::string stackTrace;
24  };
25 
26  namespace Internal
27  {
28  void HandleErrorCode(ErrorCode ec);
29  void HandleErrorCode(NativeErrorCode nec);
30  void HandleErrorCode(NativeErrorCode nec, ErrorCode& ec);
31  }
32 }
33 
34 namespace std
35 {
36  inline std::string to_string(AngouriMath::ErrorCode e)
37  {
38  return e.Name();
39  }
40 }
Definition: AngouriMath.h:103
Definition: ErrorCode.h:8