Hubspot_Helpers::check_for_errors( $response )

Method extract_error


Parameters Parameters

$response

(Required)

$user_id

(Required)

$action_data

(Required)

$recipe_id

(Required)


Top ↑

Return Return

(void)


Source Source

File: src/integrations/hubspot/helpers/hubspot-helpers.php

	public function check_for_errors( $response ) {

		if ( 200 !== intval( $response['statusCode'] ) ) {		
			throw new \Exception( __( 'API returned an error: ', 'uncanny-automator' ) . $response['statusCode'], $response['statusCode'] );
		}

		if ( isset( $response['data']['status'] ) && 'error' === $response['data']['status'] ) {
			throw new \Exception( $response['data']['message'] );
		}
	}