WordPress at a glance
function is not described

Automattic\WooCommerce\Blocks\Domain\Services

ExtendRestApi::throw_exception() private WC 1.0

Throws error and/or silently logs it.

{} It's a method of the class: ExtendRestApi{}

No Hooks.

Return

Null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->throw_exception( $exception_or_error );
$exception_or_error(string|Throwable) (required)
Error message or Exception.

Code of ExtendRestApi::throw_exception() WC 5.0.0

<?php
private function throw_exception( $exception_or_error ) {
	if ( is_string( $exception_or_error ) ) {
		$exception = new Exception( $exception_or_error );
	} else {
		$exception = $exception_or_error;
	}
	// Always log an error.
	wc_caught_exception( $exception );
	if ( defined( 'WP_DEBUG' ) && WP_DEBUG && current_user_can( 'manage_woocommerce' ) ) {
		throw $exception;
	}
}