# Stackdriver Error Reporting V1beta1 Client - Class ErrorContext (0.26.1)

0.26.1 (latest) 0.26.0 0.25.3 0.24.0 0.23.1 0.22.10 0.21.1 0.20.2 0.19.12

> [!WARNING]
> **Beta**
>
>
> This library is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1)
> of the Terms of Service. Pre-GA libraries might have limited support,
> and changes to pre-GA libraries might not be compatible with other pre-GA versions.
> For more information, see the
> [launch stage descriptions](https://docs.cloud.google.com/products#product-launch-stages).

Reference documentation and code samples for the Stackdriver Error Reporting V1beta1 Client class ErrorContext.

A description of the context in which an error occurred.

This data should be provided by the application when reporting an error,
unless the
error report has been generated automatically from Google App Engine logs.

Generated from protobuf message `google.devtools.clouderrorreporting.v1beta1.ErrorContext`

## Namespace

Google \\ Cloud \\ ErrorReporting \\ V1beta1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ http_request` | `https://docs.cloud.google.com/php/docs/reference/cloud-error-reporting/latest/V1beta1.HttpRequestContext` The HTTP request which was processed when the error was triggered. |
| `↳ user` | `string` The user who caused or was affected by the crash. This can be a user ID, an email address, or an arbitrary token that uniquely identifies the user. When sending an error report, leave this field empty if the user was not logged in. In this case the Error Reporting system will use other data, such as remote IP address, to distinguish affected users. See `affected_users_count` in `ErrorGroupStats`. |
| `↳ report_location` | `https://docs.cloud.google.com/php/docs/reference/cloud-error-reporting/latest/V1beta1.SourceLocation` The location in the source code where the decision was made to report the error, usually the place where it was logged. For a logged exception this would be the source line where the exception is logged, usually close to the place where it was caught. |

### getHttpRequest

The HTTP request which was processed when the error was
triggered.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-error-reporting/latest/V1beta1.HttpRequestContext|null` |   |

### hasHttpRequest

### clearHttpRequest

### setHttpRequest

The HTTP request which was processed when the error was
triggered.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-error-reporting/latest/V1beta1.HttpRequestContext` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getUser

The user who caused or was affected by the crash.

This can be a user ID, an email address, or an arbitrary token that
uniquely identifies the user.
When sending an error report, leave this field empty if the user was not
logged in. In this case the
Error Reporting system will use other data, such as remote IP address, to
distinguish affected users. See `affected_users_count` in
`ErrorGroupStats`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setUser

The user who caused or was affected by the crash.

This can be a user ID, an email address, or an arbitrary token that
uniquely identifies the user.
When sending an error report, leave this field empty if the user was not
logged in. In this case the
Error Reporting system will use other data, such as remote IP address, to
distinguish affected users. See `affected_users_count` in
`ErrorGroupStats`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getReportLocation

The location in the source code where the decision was made to
report the error, usually the place where it was logged.

For a logged exception this would be the source line where the
exception is logged, usually close to the place where it was
caught.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-error-reporting/latest/V1beta1.SourceLocation|null` |   |

### hasReportLocation

### clearReportLocation

### setReportLocation

The location in the source code where the decision was made to
report the error, usually the place where it was logged.

For a logged exception this would be the source line where the
exception is logged, usually close to the place where it was
caught.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-error-reporting/latest/V1beta1.SourceLocation` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |