Automattic\WooCommerce\Internal\PushNotifications\Services

DriverAvailabilityService::log_throwable │ private │ WC 1.0

Logs a swallowed throwable, distinguishing an Error from an Exception.

An Exception here usually means Jetpack answered unhappily; an Error means the call was incompatible, which is a WooCommerce problem rather than a merchant one. Both are swallowed, so the log is the only place the difference survives.

Method of the class: DriverAvailabilityService{}

No Hooks.

Returns

void. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->log_throwable( $message, $e, ?LegacyProxy $proxy ): void;
$message(string) (required)
The message describing what was being determined.
$e(Throwable) (required)
The caught throwable.
?LegacyProxy $proxy
.
Default: null

DriverAvailabilityService::log_throwable() code WC 11.3.0

private function log_throwable( string $message, Throwable $e, ?LegacyProxy $proxy = null ): void {
	try {
		$this->write_log( $message, $e, $proxy );
	} catch ( Throwable $ignored ) {
		// Logging is best effort. Failing to record why something went wrong must
		// never be worse than the original failure, which callers have handled.
		return;
	}
}