Improve exception logging

Log.e() has trouble with null strings, and passing e.getMessage() to
it would lead to issues.