How to retrieve error details inside the on-error clause

The question is about getting the on-error detailed info.
The bad URL is just an example that generates an error.