Title: Requests_Exception::__construct
Published: August 16, 2016
Last modified: November 2, 2022

---

# Requests_Exception::__construct( string $message, string $type, mixed $data = null, integer $code )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/requests_exception/__construct/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/classes/requests_exception/__construct/?output_format=md#source)

[ Back to top](https://developer.wordpress.org/reference/classes/requests_exception/__construct/?output_format=md#wp--skip-link--target)

Create a new exception

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/requests_exception/__construct/?output_format=md#parameters)󠁿

 `$message`stringrequired

Exception message

`$type`stringrequired

Exception type

`$data`mixedoptional

Associated data

Default:`null`

`$code`integerrequired

Exception numerical code, if applicable

## 󠀁[Source](https://developer.wordpress.org/reference/classes/requests_exception/__construct/?output_format=md#source)󠁿

[View all references](https://developer.wordpress.org/reference/files/wp-includes/requests/exception.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/Requests/Exception.php#L36)

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Frequests_exception%2F__construct%2F)
before being able to contribute a note or feedback.