Improved error handling. Causing exception's message is put to log as
well.