Error Handling
This commit is contained in:
parent
54168a4a4d
commit
d40132370d
|
@ -16,26 +16,41 @@ namespace Syntriax.Modules.Factory
|
|||
if (IsInitialized)
|
||||
return;
|
||||
|
||||
OnFactoryInitialize();
|
||||
|
||||
IsInitialized = true;
|
||||
|
||||
try
|
||||
{
|
||||
OnFactoryInitialize();
|
||||
|
||||
OnInitialized?.Invoke(this);
|
||||
OnStateChanged?.Invoke(this);
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
if (!IsInitialized)
|
||||
return;
|
||||
|
||||
OnFactoryReset();
|
||||
|
||||
IsInitialized = false;
|
||||
|
||||
try
|
||||
{
|
||||
OnFactoryReset();
|
||||
|
||||
OnReset?.Invoke(this);
|
||||
OnStateChanged?.Invoke(this);
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Initialize"/>
|
||||
protected abstract void OnFactoryInitialize();
|
||||
|
|
Loading…
Reference in New Issue