Add Engine::ReportCrash event for custom crash reporting or handling
This commit is contained in:
@@ -71,6 +71,7 @@ Action Engine::Draw;
|
||||
Action Engine::Pause;
|
||||
Action Engine::Unpause;
|
||||
Action Engine::RequestingExit;
|
||||
Delegate<StringView, void*> Engine::ReportCrash;
|
||||
FatalErrorType Engine::FatalError = FatalErrorType::None;
|
||||
bool Engine::IsRequestingExit = false;
|
||||
int32 Engine::ExitCode = 0;
|
||||
|
||||
@@ -83,6 +83,11 @@ public:
|
||||
/// </summary>
|
||||
API_EVENT() static Action RequestingExit;
|
||||
|
||||
/// <summary>
|
||||
/// The custom handler for engine crash handling and reporting. Can be used to override default message box with a custom one or send crash report to telemetry service. Args are: error message and context pointer (for stack-trace access).
|
||||
/// </summary>
|
||||
API_EVENT() static Delegate<StringView, void*> ReportCrash;
|
||||
|
||||
/// <summary>
|
||||
/// The current state of the fatal error. Set to None if no error occurred yet.
|
||||
/// </summary>
|
||||
|
||||
@@ -372,7 +372,10 @@ void PlatformBase::Fatal(const StringView& msg, void* context, FatalErrorType er
|
||||
}
|
||||
|
||||
// Show error message
|
||||
Error(msg);
|
||||
if (Engine::ReportCrash.IsBinded())
|
||||
Engine::ReportCrash(msg, context);
|
||||
else
|
||||
Error(msg);
|
||||
|
||||
// Only main thread can call exit directly
|
||||
if (IsInMainThread())
|
||||
|
||||
Reference in New Issue
Block a user