tribe_catch_and_throw( $errno,  $errstr )

A convenience function used to cast errors to exceptions.

Use in set_error_handler calls:

 try{
     set_error_handler( 'tribe_catch_and_throw' );
     // ...do something that could generate an error...
     restore_error_handler();
 } catch ( RuntimeException $e ) {
     // Handle the exception.
 }

See also


Top ↑

Source

File: src/functions/utils.php

	function tribe_catch_and_throw( $errno, $errstr ) {
		throw new RuntimeException( $errstr, $errno );
	}

Top ↑

Changelog

Changelog
Version Description
4.9.5 Introduced.