-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGlobal.asax.cs
36 lines (33 loc) · 1.38 KB
/
Global.asax.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Routing;
using System.Xml.Linq;
using DevExpress.DashboardWeb;
namespace MvcThrowCustomExceptionDashboardErrorToast {
public class MvcApplication : System.Web.HttpApplication {
protected void Application_Start() {
ControllerBuilder.Current.SetControllerFactory(typeof(RestrictedControllerFactory));
DashboardConfig.RegisterService(RouteTable.Routes);
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
DashboardConfigurator.Default.SetDashboardStorage(new CustomDashboardStorage());
}
}
public class CustomException : Exception {
public const string SafeMessage = "Custom exception text for end users";
public const string UnsafeMessage = "Custom exception text for developers";
}
public class CustomDashboardStorage : IDashboardStorage {
IEnumerable<DashboardInfo> IDashboardStorage.GetAvailableDashboardsInfo() {
return new[] {
new DashboardInfo { ID = "Dashboard", Name = "Dashboard" }
};
}
XDocument IDashboardStorage.LoadDashboard(string dashboardID) {
throw new CustomException();
}
void IDashboardStorage.SaveDashboard(string dashboardID, XDocument dashboard) {
}
}
}