Safely executes function and handles errors
Function to execute
Optional
Optional error handler
Function result or undefined if error
Safely executes function and handles errors