/
dundich
/
sa
Обзор
Документация
Войти
/
dundich
/
sa
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Sa/Extensions/ExceptionExtensions.cs
33 строки
978 B
krivchenko-kv
Normalize all the line endings
21 апр 2025, 19:14
21 апр 2025, 19:14
c1bf7cc
Код
Авторство
О чём код?
using System.Diagnostics; using System.Text; namespace Sa.Extensions; public static class ExceptionExtensions { [DebuggerStepThrough] public static bool IsCritical(this Exception ex) { if (ex is OutOfMemoryException) return true; if (ex is StackOverflowException) return true; if (ex is AppDomainUnloadedException) return true; if (ex is BadImageFormatException) return true; if (ex is CannotUnloadAppDomainException) return true; if (ex is InvalidProgramException) return true; if (ex is ThreadAbortException) return true; return false; } [DebuggerStepThrough] public static string GetErrorMessages(this Exception exception) { StringBuilder sb = new(); sb.AppendLine(exception.Message); if (exception.InnerException != null) { sb.AppendLine(GetErrorMessages(exception.InnerException)); } return sb.ToString(); } }