fix expception handling to log error details