Custom Function Error Handling

Custom Function Error Handling

Why don't custom functions have error handling?

We have a custom function attached to a button that uses sendmail. If this function fails, it fails silently!

It would appear that these failures are not recorded anywhere.

It also appears that it's not possible to capture any error messages and return these to the user.

Well written code does not fail silently. It should be recorded in a log and ideally the user should receive feedback about the failure.

I'm hoping that someone is going to correct me and tell me where I can see logged failures and how I can return feedback to user.