diff --git a/Bootstrap.Admin/Controllers/Api/NotificationsController.cs b/Bootstrap.Admin/Controllers/Api/NotificationsController.cs
index 0b85ce60..73bb5cd0 100644
--- a/Bootstrap.Admin/Controllers/Api/NotificationsController.cs
+++ b/Bootstrap.Admin/Controllers/Api/NotificationsController.cs
@@ -47,7 +47,7 @@ namespace Bootstrap.Admin.Controllers.Api
message.AsParallel().ForAll(m => m.FromIcon = Url.Content(m.FromIcon));
//Apps
- var apps = ExceptionsHelper.Retrieves().Where(n => n.ExceptionType != "Longbow.Data.DBAccessException");
+ var apps = ExceptionsHelper.Retrieves().Where(n => n.Category != "DB");
var appExceptionsCount = apps.Count();
apps = apps.Take(6);
@@ -62,7 +62,7 @@ namespace Bootstrap.Admin.Controllers.Api
});
//Dbs
- var dbs = ExceptionsHelper.Retrieves().Where(n => n.ExceptionType == "Longbow.Data.DBAccessException");
+ var dbs = ExceptionsHelper.Retrieves().Where(n => n.Category == "DB");
var dbExceptionsCount = dbs.Count();
dbs = dbs.Take(6);
diff --git a/Bootstrap.DataAccess/Exceptions.cs b/Bootstrap.DataAccess/Exceptions.cs
index bd07f250..5703281c 100644
--- a/Bootstrap.DataAccess/Exceptions.cs
+++ b/Bootstrap.DataAccess/Exceptions.cs
@@ -3,7 +3,8 @@ using PetaPoco;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
-
+using System.Data.Common;
+
namespace Bootstrap.DataAccess
{
///
@@ -61,6 +62,11 @@ namespace Bootstrap.DataAccess
///
public string Period { get; set; }
+ ///
+ ///
+ ///
+ public string Category { get; set; }
+
private static void ClearExceptions() => System.Threading.Tasks.Task.Run(() =>
{
DbManager.Create().Execute("delete from Exceptions where LogTime < @0", DateTime.Now.AddMonths(0 - DictHelper.RetrieveExceptionsLogPeriod()));
@@ -76,7 +82,18 @@ namespace Bootstrap.DataAccess
{
if (ex == null) return true;
- var errorPage = additionalInfo?["ErrorPage"] ?? (ex.GetType().Name.Length > 50 ? ex.GetType().Name.Substring(0, 50) : ex.GetType().Name);
+ var errorPage = additionalInfo?["ErrorPage"] ?? (ex.GetType().Name.Length > 50 ? ex.GetType().Name.Substring(0, 50) : ex.GetType().Name);
+ var loopEx = ex;
+ var category = "App";
+ while (loopEx != null)
+ {
+ if (typeof(DbException).IsAssignableFrom(loopEx.GetType()))
+ {
+ category = "DB";
+ break;
+ }
+ loopEx = loopEx.InnerException;
+ }
DbManager.Create().Insert(new Exceptions
{
AppDomainName = AppDomain.CurrentDomain.FriendlyName,
@@ -86,7 +103,8 @@ namespace Bootstrap.DataAccess
ExceptionType = ex.GetType().FullName,
Message = ex.Message,
StackTrace = ex.StackTrace,
- LogTime = DateTime.Now
+ LogTime = DateTime.Now,
+ Category = category
});
ClearExceptions();
return true;
diff --git a/DatabaseScripts/Install.sql b/DatabaseScripts/Install.sql
index 767c65ef..14789910 100644
--- a/DatabaseScripts/Install.sql
+++ b/DatabaseScripts/Install.sql
@@ -324,6 +324,7 @@ CREATE TABLE [dbo].[Exceptions](
[Message] [nvarchar](max) NOT NULL,
[StackTrace] [nvarchar](max) NULL,
[LogTime] [datetime] NOT NULL,
+ [Category] [varchar](50) NULL,
CONSTRAINT [PK_Exceptions] PRIMARY KEY CLUSTERED
(
[ID] ASC
diff --git a/DatabaseScripts/MySQL/install.sql b/DatabaseScripts/MySQL/install.sql
index d720af28..2423ed3d 100644
--- a/DatabaseScripts/MySQL/install.sql
+++ b/DatabaseScripts/MySQL/install.sql
@@ -105,7 +105,8 @@ CREATE TABLE Exceptions(
ExceptionType TEXT NOT NULL,
Message TEXT NOT NULL,
StackTrace TEXT NULL,
- LogTime DATETIME NOT NULL
+ LogTime DATETIME NOT NULL,
+ Category VARCHAR (50) NULL
);
CREATE TABLE Dicts(
diff --git a/DatabaseScripts/Postgresql/install.sql b/DatabaseScripts/Postgresql/install.sql
index e7e75097..34276d44 100644
--- a/DatabaseScripts/Postgresql/install.sql
+++ b/DatabaseScripts/Postgresql/install.sql
@@ -105,7 +105,8 @@ CREATE TABLE Exceptions(
ExceptionType TEXT NOT NULL,
Message TEXT NOT NULL,
StackTrace TEXT NULL,
- LogTime DATE NOT NULL
+ LogTime DATE NOT NULL,
+ Category VARCHAR (50) NULL
);
CREATE TABLE Dicts(
diff --git a/DatabaseScripts/SQLite/Install.sql b/DatabaseScripts/SQLite/Install.sql
index 1860a50c..d90a7b21 100644
--- a/DatabaseScripts/SQLite/Install.sql
+++ b/DatabaseScripts/SQLite/Install.sql
@@ -105,7 +105,8 @@ CREATE TABLE Exceptions(
ExceptionType TEXT NOT NULL,
Message TEXT NOT NULL,
StackTrace TEXT NULL,
- LogTime DATETIME NOT NULL
+ LogTime DATETIME NOT NULL,
+ Category VARCHAR (50) NULL
);
CREATE TABLE Dicts(