Adding exception hook.