You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
826 B
42 lines
826 B
using System;
|
|
using System.Diagnostics;
|
|
|
|
namespace JiLinApp.Core.Avalonia;
|
|
|
|
public class RxAppExceptionHandler : IObserver<Exception>
|
|
{
|
|
private static RxAppExceptionHandler? _instance;
|
|
|
|
public static RxAppExceptionHandler Instance
|
|
{
|
|
get
|
|
{
|
|
return _instance ??= new();
|
|
}
|
|
}
|
|
|
|
public delegate void ExceptionHandler(Exception e);
|
|
|
|
public event ExceptionHandler? OnExceptionHandler;
|
|
|
|
public void OnNext(Exception e)
|
|
{
|
|
if (Debugger.IsAttached) Debugger.Break();
|
|
OnException(e);
|
|
}
|
|
|
|
public void OnError(Exception e)
|
|
{
|
|
if (Debugger.IsAttached) Debugger.Break();
|
|
OnException(e);
|
|
}
|
|
|
|
public void OnCompleted()
|
|
{
|
|
}
|
|
|
|
private void OnException(Exception e)
|
|
{
|
|
OnExceptionHandler?.Invoke(e);
|
|
}
|
|
}
|