How to retrieve error details inside the on-error clause

As far as I have seen you can use on-error for two things.

  1. Prevent script from stop running if there are one or more error.
  2. Run an alternate code if some error occurs.

I have not seen any possibility to get the actual error listed.
That would be nice to have, so if MT reads this, please add.