Refined 1449fe6c1b38e85cfd4b37e607a56120952853b5 to better handle UndeclaredThrowableException.