acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
exception.h
1#pragma once
2
3
4#include "acme/operating_system/error_code.h"
5
6//#include "acme/prototype/collection/array.h"
7
8#include "acme/prototype/string/scoped_string_base.h"
9
10
11enum enum_consequence
12{
13
14 e_consequence_none,
15 e_consequence_fatal,
16 e_consequence_blocking,
17 e_consequence_workaroundable,
18 e_consequence_too_generic_and_context_dependant,
19
20};
21
22
23class CLASS_DECL_ACME exception :
24 virtual public ::particle
25{
26public:
27
28
29 ::e_status m_estatus;
30
31 bool m_bDumpCallStackTrace;
32 string m_strCallStackTrace;
33 bool m_bHandled;
34 bool m_bContinue;
35 enum_consequence m_econsequenceUserDefault;
36 string m_strTitle;
37 string m_strMessage; // Message for the user
38 string m_strDetails; // Details about exception (if available/applicable)
39 //string m_strException;
40
41 // A exception class is meant to be a small utility/tool class.
42 // m_bLog -> too much managing (micro-managing and also big-managing)
43 // from utility/tool small class of the Logging system()->
44 // General-ever Log can be done by final handlers at Main Loop and crash handlers
45 // Log can be supressed or translated at optional middle-stack handlers.
46 // bool m_bLog;
47 string m_strLink;
48 string m_strFile;
49 ::i32 m_iLine;
50 ::array_base < error_code > m_errorcodea;
51 static bool s_bEnableCallStackBackTrace;
52
53
54 exception();
55//#ifdef __ANDROID__
56// exception(const ::e_status & estatus, const ::scoped_string & scopedstrMessage = nullptr, const ::scoped_string & scopedstrDetails = nullptr, ::i32 iSkip = CALLSTACK_DEFAULT_SKIP_TRIGGER);
57//#else
58 exception(const ::e_status& estatus, const ::scoped_string& scopedstrMessage = {}, const ::scoped_string& scopedstrDetails = {}, ::i32 iSkip = CALLSTACK_DEFAULT_SKIP_TRIGGER, void* caller_address = nullptr);
59//#endif
60 exception(const ::e_status& estatus, const ::array_base < error_code > & errorcodea, const ::scoped_string& scopedstrMessage = {}, const ::scoped_string& scopedstrDetails = {}, ::i32 iSkip = CALLSTACK_DEFAULT_SKIP_TRIGGER, void* caller_address = nullptr);
61 exception(const ::exception& exception);
62 ~exception() override;
63
64
65 ::pointer < ::subparticle > clone() override;
66
67
68 static void enable_call_stack_back_trace(bool bEnable);
69
70
71 virtual string get_message() const;
72
73 virtual string get_title() const;
74
75 virtual string get_consolidated_details(::particle * pparticle) const;
76
77
78 inline ::e_status estatus() const { return m_estatus; }
79
80
81};
82
83
84#define RETURN_OR_THROW(bReturn, ppexception, EXCEPTION, ...) \
85 if(bReturn) \
86 { \
87 if(ppexception) *ppexception = allocateø EXCEPTION(__VA_ARGS__); \
88 return; \
89 } \
90 throw EXCEPTION(__VA_ARGS__)
91
92
93
94CLASS_DECL_ACME write_text_stream & operator <<(write_text_stream & stream, const ::exception & exception);
95
Definition particle.h:95
Definition ___serialization_draft.h:42
Definition write_text_stream.h:43