Fixed `onException` to also catch synchronous exceptions