Better handling of errors in script callback functions.