# Google.Cloud.Diagnostics.AspNetCore3 - Class ErrorReportingExceptionLoggerMiddleware (5.3.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [5.3.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore3/latest/Google.Cloud.Diagnostics.AspNetCore3.ErrorReportingExceptionLoggerMiddleware)
- [5.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore3/5.2.0/Google.Cloud.Diagnostics.AspNetCore3.ErrorReportingExceptionLoggerMiddleware)
- [5.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore3/5.1.0/Google.Cloud.Diagnostics.AspNetCore3.ErrorReportingExceptionLoggerMiddleware)
- [5.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore3/5.0.0/Google.Cloud.Diagnostics.AspNetCore3.ErrorReportingExceptionLoggerMiddleware)
- [4.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore3/4.4.0/Google.Cloud.Diagnostics.AspNetCore3.ErrorReportingExceptionLoggerMiddleware)
- [4.3.1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore3/4.3.1/Google.Cloud.Diagnostics.AspNetCore3.ErrorReportingExceptionLoggerMiddleware)

    public sealed class ErrorReportingExceptionLoggerMiddleware

Reference documentation and code samples for the Google.Cloud.Diagnostics.AspNetCore3 class ErrorReportingExceptionLoggerMiddleware.

Middleware that will, when invoked, call the next [RequestDelegate](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.http.requestdelegate),
catch any exception that it may throw, send that exception to the
Google Cloud Error Reporting API and rethrow the given exception.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> ErrorReportingExceptionLoggerMiddleware

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Diagnostics.AspNetCore3](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore3/latest/Google.Cloud.Diagnostics.AspNetCore3)

## Assembly

Google.Cloud.Diagnostics.AspNetCore3.dll

## Constructors

### ErrorReportingExceptionLoggerMiddleware(RequestDelegate, IExceptionLogger)

    public ErrorReportingExceptionLoggerMiddleware(RequestDelegate next, IExceptionLogger logger)

Create a new instance of [ErrorReportingExceptionLoggerMiddleware](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore3/latest/Google.Cloud.Diagnostics.AspNetCore3.ErrorReportingExceptionLoggerMiddleware).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `next` | `https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.http.requestdelegate` The next request delegate. Must not be null. |
| `logger` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Diagnostics.AspNetCore3/latest/Google.Cloud.Diagnostics.AspNetCore3.IExceptionLogger` A logger that will report exceptions. Must not be null. |

## Methods

### Invoke(HttpContext)

    public Task Invoke(HttpContext httpContext)

Invokes the next [RequestDelegate](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.http.requestdelegate), catches any exception thrown,
reports the exception to the Google Cloud Error Reporting API and rethrows
the exception.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `httpContext` | `https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.http.httpcontext` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` |   |