Skip to content

Commit

Permalink
Report unhandled errors .
Browse files Browse the repository at this point in the history
  • Loading branch information
RusselWebber committed Dec 6, 2024
1 parent 51d1e6b commit 801ac57
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions xlDuckDb/xlAddIn.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
using ExcelDna.Integration;
using ExcelDna.Logging;
using System.Diagnostics;
using System;
using ExcelDna.Integration;

namespace xlDuckDb
{
public class xlAddIn : IExcelAddIn
{
private const string ErrorPrefix = "#ERR";

public void AutoOpen()
{
ExcelIntegration.RegisterUnhandledExceptionHandler(
ex =>
{
if (ex is Exception e) return $"{ErrorPrefix} - {e.Message}";
return $"{ErrorPrefix} - {ex}";
});
}

public void AutoClose()
Expand Down

0 comments on commit 801ac57

Please sign in to comment.