Log detailed exceptions before error hook

Change-Id: Ifa1cf7f7446a8360dabd0ca199c9019fad1d47c0