Add function to override system exception hook.