# Stackdriver Error Reporting V1beta1 Client - Class ReportedErrorEvent (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 ReportedErrorEvent.

An error event which is reported to the Error Reporting system.

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

## Namespace

Google \\ Cloud \\ ErrorReporting \\ V1beta1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ event_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Optional. Time when the event occurred. If not provided, the time when the event was received by the Error Reporting system is used. If provided, the time must not exceed the [logs retention period](https://cloud.google.com/logging/quotas#logs_retention_periods) in the past, or be more than 24 hours in the future. If an invalid time is provided, then an error is returned. |
| `↳ service_context` | `https://docs.cloud.google.com/php/docs/reference/cloud-error-reporting/latest/V1beta1.ServiceContext` Required. The service context in which this error has occurred. |
| `↳ message` | `string` Required. The error message. If no `context.reportLocation` is provided, the message must contain a header (typically consisting of the exception type name and an error message) and an exception stack trace in one of the supported programming languages and formats. Supported languages are Java, Python, JavaScript, Ruby, C#, PHP, and Go. Supported stack trace formats are: \* \* **Java** : Must be the return value of [`Throwable.printStackTrace()`](https://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#printStackTrace%28%29). \* \* **Python** : Must be the return value of [`traceback.format_exc()`](https://docs.python.org/2/library/traceback.html#traceback.format_exc). \* \* **JavaScript** : Must be the value of [`error.stack`](https://github.com/v8/v8/wiki/Stack-Trace-API) as returned by V8. \* \* **Ruby** : Must contain frames returned by [`Exception.backtrace`](https://ruby-doc.org/core-2.2.0/Exception.html#method-i-backtrace). \* \* **C#** : Must be the return value of [`Exception.ToString()`](https://msdn.microsoft.com/en-us/library/system.exception.tostring.aspx). \* \* **PHP** : Must be prefixed with `"PHP (Notice|Parse error|Fatal error|Warning): "` and contain the result of [`(string)$exception`](https://php.net/manual/en/exception.tostring.php). \* \* **Go** : Must be the return value of [`runtime.Stack()`](https://golang.org/pkg/runtime/debug/#Stack). |
| `↳ context` | `https://docs.cloud.google.com/php/docs/reference/cloud-error-reporting/latest/V1beta1.ErrorContext` Optional. A description of the context in which the error occurred. |

### getEventTime

Optional. Time when the event occurred.

If not provided, the time when the event was received by the
Error Reporting system is used. If provided, the time must not
exceed the [logs retention
period](https://cloud.google.com/logging/quotas#logs_retention_periods) in
the past, or be more than 24 hours in the future.
If an invalid time is provided, then an error is returned.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasEventTime

### clearEventTime

### setEventTime

Optional. Time when the event occurred.

If not provided, the time when the event was received by the
Error Reporting system is used. If provided, the time must not
exceed the [logs retention
period](https://cloud.google.com/logging/quotas#logs_retention_periods) in
the past, or be more than 24 hours in the future.
If an invalid time is provided, then an error is returned.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

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

### getServiceContext

Required. The service context in which this error has occurred.

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

### hasServiceContext

### clearServiceContext

### setServiceContext

Required. The service context in which this error has occurred.

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

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

### getMessage

Required. The error message.

If no `context.reportLocation` is provided, the message must contain a
header (typically consisting of the exception type name and an error
message) and an exception stack trace in one of the supported programming
languages and formats.
Supported languages are Java, Python, JavaScript, Ruby, C#, PHP, and Go.
Supported stack trace formats are:

- **Java** : Must be the return value of [`Throwable.printStackTrace()`](https://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#printStackTrace%28%29).
- **Python** : Must be the return value of [`traceback.format_exc()`](https://docs.python.org/2/library/traceback.html#traceback.format_exc).
- **JavaScript** : Must be the value of [`error.stack`](https://github.com/v8/v8/wiki/Stack-Trace-API) as returned by V8.
- **Ruby** : Must contain frames returned by [`Exception.backtrace`](https://ruby-doc.org/core-2.2.0/Exception.html#method-i-backtrace).
- **C#** : Must be the return value of [`Exception.ToString()`](https://msdn.microsoft.com/en-us/library/system.exception.tostring.aspx).
- **PHP** : Must be prefixed with `"PHP (Notice|Parse error|Fatal
  error|Warning): "` and contain the result of [`(string)$exception`](https://php.net/manual/en/exception.tostring.php).
- **Go** : Must be the return value of [`runtime.Stack()`](https://golang.org/pkg/runtime/debug/#Stack).

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

### setMessage

Required. The error message.

If no `context.reportLocation` is provided, the message must contain a
header (typically consisting of the exception type name and an error
message) and an exception stack trace in one of the supported programming
languages and formats.
Supported languages are Java, Python, JavaScript, Ruby, C#, PHP, and Go.
Supported stack trace formats are:

- **Java** : Must be the return value of [`Throwable.printStackTrace()`](https://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#printStackTrace%28%29).
- **Python** : Must be the return value of [`traceback.format_exc()`](https://docs.python.org/2/library/traceback.html#traceback.format_exc).
- **JavaScript** : Must be the value of [`error.stack`](https://github.com/v8/v8/wiki/Stack-Trace-API) as returned by V8.
- **Ruby** : Must contain frames returned by [`Exception.backtrace`](https://ruby-doc.org/core-2.2.0/Exception.html#method-i-backtrace).
- **C#** : Must be the return value of [`Exception.ToString()`](https://msdn.microsoft.com/en-us/library/system.exception.tostring.aspx).
- **PHP** : Must be prefixed with `"PHP (Notice|Parse error|Fatal
  error|Warning): "` and contain the result of [`(string)$exception`](https://php.net/manual/en/exception.tostring.php).
- **Go** : Must be the return value of [`runtime.Stack()`](https://golang.org/pkg/runtime/debug/#Stack).

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

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

### getContext

Optional. A description of the context in which the error occurred.

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

### hasContext

### clearContext

### setContext

Optional. A description of the context in which the error occurred.

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

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