error_to_string() should support exceptions too
Feature Request
- Yes, I reviewed the contribution guidelines.
Describe your use case and the problem you are facing
When calling WP_CLI::error( $message ), either a string or a WP_Error instance can be passed in as the message, and the WP_CLI::error_to_string( $errors ) method handles the conversion to string, including its error data as necessary.
It would be great if Exception instances were supported too, so you could write code such as:
try { ... } catch ( Exception $e ) { WP_CLI::error( $e ); }