Skip to content

Commit

Permalink
* Implemented #1968
Browse files Browse the repository at this point in the history
  • Loading branch information
PWagner1 committed Dec 17, 2024
1 parent 164ae6a commit d14f835
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 24 deletions.
2 changes: 2 additions & 0 deletions Documents/Changelog/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
=======

## 2025-11-xx - Build 2511 - November 2025
* Implemented [#1968](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1968), Open up 'ExceptionHandler' for public use
- To invoke, use `KryptonExceptionHandler`
* Resolved [#560](https://github.com/Krypton-Suite/Standard-Toolkit/issues/560), CheckBox Images are not scaled with dpi Awareness
* Resolved [#565](https://github.com/Krypton-Suite/Standard-Toolkit/issues/565), GroupBox icons are not scaled for dpi awareness
* Resolved [#559](https://github.com/Krypton-Suite/Standard-Toolkit/issues/559), Header group icon is not scaled for dpi awareness
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2246,7 +2246,7 @@ public void ImportWithUpgrade(string themeFilePath)
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e);
KryptonExceptionHandler.CaptureException(e);
}
finally
{
Expand Down Expand Up @@ -2295,7 +2295,7 @@ private void PerformUpgrade(Stream stream)
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
}

Expand Down Expand Up @@ -3260,7 +3260,7 @@ private void ImportFromXmlDocument([DisallowNull] XmlDocument doc)
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
finally
{
Expand Down Expand Up @@ -3400,7 +3400,7 @@ private XmlDocument ExportToXmlDocument(bool ignoreDefaults)
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);

return new XmlDocument();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#region BSD License
/*
*
* New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE)
* Modifications by Peter Wagner(aka Wagnerp), Simon Coghlan(aka Smurf-IV), Giduac, et al. 2024 - 2025. All rights reserved.
*
*/
#endregion

namespace Krypton.Toolkit
{
/// <summary></summary>
[ToolboxItem(false)]
[DesignerCategory(@"code")]
public static class KryptonExceptionHandler
{
#region Public

/// <summary>Captures the exception.</summary>
/// <param name="exception">The exception.</param>
/// <param name="title">The title.</param>
/// <param name="callerFilePath">The caller file path.</param>
/// <param name="lineNumber">The line number.</param>
/// <param name="callerMethod">The caller method.</param>
/// <param name="showStackTrace">if set to <c>true</c> [show stack trace].</param>
/// <param name="useExceptionDialog">The use exception dialog.</param>
public static void CaptureException(Exception exception,
string title = "Exception Caught",
[CallerFilePath] string callerFilePath = "",
[CallerLineNumber] int lineNumber = 0,
[CallerMemberName] string callerMethod = "",
bool showStackTrace = false, bool? useExceptionDialog = true) =>
ExceptionHandler.CaptureException(exception, title, callerFilePath, lineNumber, callerMethod,
showStackTrace, useExceptionDialog);

/// <summary>Prints the stack trace.</summary>
/// <param name="exception">The exception.</param>
/// <param name="fileName">Name of the file.</param>
public static void PrintStackTrace(Exception exception, string fileName) =>
ExceptionHandler.PrintStackTrace(exception, fileName);

/// <summary>Prints the exception stack trace.</summary>
/// <param name="exception">The exception.</param>
/// <param name="fileName">Name of the file.</param>
public static void PrintExceptionStackTrace(Exception exception, string fileName) =>
ExceptionHandler.PrintExceptionStackTrace(exception, fileName);

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ public void ShowIntegrateToolBar(bool showIntegratedToolBar, KryptonForm parentF
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
}

Expand All @@ -404,7 +404,7 @@ public void AttachIntegratedToolBarToParent(KryptonForm? parentForm)
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
}

Expand All @@ -431,7 +431,7 @@ public void DetachIntegratedToolBarFromParent(KryptonForm? parentForm)
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
}

Expand Down Expand Up @@ -489,7 +489,7 @@ public void UpdateButtonOrientation(PaletteButtonOrientation buttonOrientation)
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
}

Expand Down Expand Up @@ -529,7 +529,7 @@ public void UpdateButtonAlignment(PaletteRelativeEdgeAlign buttonAlignment)
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private void klwlblDetails_LinkClicked(object sender, LinkLabelLinkClickedEventA
}
catch (Exception exception)
{
ExceptionHandler.CaptureException(exception, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(exception, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private void OnUpgradePalette(object? sender, EventArgs e)
}
catch (Exception exc)
{
ExceptionHandler.CaptureException(exc, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(exc, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
}
#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private void OnUpgrade(object? sender, EventArgs e)
}
catch (Exception exc)
{
ExceptionHandler.CaptureException(exc, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(exc, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ internal void SetupToolBar()
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
}

Expand All @@ -79,7 +79,7 @@ internal void ShowToolBar(bool visible)
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static void ApplyGlobalTheme(KryptonManager manager, PaletteMode paletteM
}
catch (Exception exc)
{
ExceptionHandler.CaptureException(exc, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(exc, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
}

Expand Down Expand Up @@ -128,7 +128,7 @@ public static void LoadCustomTheme(KryptonCustomPaletteBase palette, KryptonMana
}
catch (Exception exc)
{
ExceptionHandler.CaptureException(exc, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(exc, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void LaunchProcess(string processName)
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
}

Expand All @@ -48,7 +48,7 @@ public static void LaunchProcess(string processName, string arguments)
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
}

Expand All @@ -62,7 +62,7 @@ public static void LaunchProcess(string processName, string arguments)
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}

return null;
Expand Down Expand Up @@ -92,7 +92,7 @@ public static void LaunchProcess(string processName, string arguments)
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static class GraphicsExtensions
{
//Console.WriteLine("Unable to extract the icon from the binary");

ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}

return result;
Expand Down Expand Up @@ -106,7 +106,7 @@ public static Icon LoadIcon(IconType type, Size size)
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);

return null;
}
Expand Down Expand Up @@ -157,7 +157,7 @@ public static Icon LoadIcon(IconType type, Size size)
}
catch (Exception ex)
{
ExceptionHandler.CaptureException(ex, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(ex, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);

// /* EXTRACT ICON ERROR */
//// BUBBLE UP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private void LaunchProcess(string processPath)
}
catch (Exception e)
{
ExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
KryptonExceptionHandler.CaptureException(e, showStackTrace: GlobalStaticValues.DEFAULT_USE_STACK_TRACE);
}
}

Expand Down

0 comments on commit d14f835

Please sign in to comment.