Class ErrorReportingExceptionFilter
Google Cloud Error Reporting System.Web.Mvc.IExceptionFilter.
Inheritance
Implements
Inherited Members
Namespace: Google.Cloud.Diagnostics.AspNet
Assembly: Google.Cloud.Diagnostics.AspNet.dll
Syntax
public class ErrorReportingExceptionFilter : IExceptionFilter, IDisposable
Remarks
Reports unhandled exceptions to Google Cloud Error Reporting. The filter should be registered first in ASP.NET MVC versions 1 and 2 and last in ASP.NET MVC versions 3 and higher. See: https://msdn.microsoft.com/en-us/library/system.web.mvc.iexceptionfilter.onexception(v=vs.118).aspx Docs: https://cloud.google.com/error-reporting/docs/
Examples
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
// Add a catch all for the uncaught exceptions.
string projectId = "[Google Cloud Platform project ID]";
string serviceName = "[Name of service]";
string version = "[Version of service]";
// Add a catch all for the uncaught exceptions.
filters.Add(ErrorReportingExceptionFilter.Create(projectId, serviceName, version));
}
Methods
Create(String, String, ErrorReportingOptions)
Creates an instance of ErrorReportingExceptionFilter using credentials as defined by GetApplicationDefaultAsync().
Can be used when running on Google App Engine or Google Compute Engine. The Google Cloud Platform project to report errors to will detected from the current platform.
Declaration
public static ErrorReportingExceptionFilter Create(string serviceName, string version, ErrorReportingOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | serviceName | An identifier of the service, such as the name of the executable or job. May be null. |
| System.String | version | Represents the source code version that the developer provided. May be null. |
| ErrorReportingOptions | options | Optional, error reporting options. |
Returns
| Type | Description |
|---|---|
| ErrorReportingExceptionFilter |
Create(String, String, String, ErrorReportingOptions)
Creates an instance of ErrorReportingExceptionFilter using credentials as defined by GetApplicationDefaultAsync().
Declaration
public static ErrorReportingExceptionFilter Create(string projectId, string serviceName, string version, ErrorReportingOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | projectId | The Google Cloud Platform project ID. Must not be null. |
| System.String | serviceName | An identifier of the service, such as the name of the executable or job. May be null. |
| System.String | version | Represents the source code version that the developer provided. May be null. |
| ErrorReportingOptions | options | Optional, error reporting options. |
Returns
| Type | Description |
|---|---|
| ErrorReportingExceptionFilter |
Dispose()
Declaration
public void Dispose()
Implements
OnException(ExceptionContext)
Declaration
public void OnException(ExceptionContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Web.Mvc.ExceptionContext | context |