Use onException for exception cleanup, and mask async exceptions