'Better' error handling in client-side script injection