One possibility is to catch the exception and throw the derivative that has this custom property.
class MyLibraryException extends LibraryException { function __construct(LibraryException $e, $custom_field){ $this->custom_field = $custom_field; ... } } try { ... } catch(LibraryException $e) { new MyLibraryException($e, $cusotm_field); }
source share