Consistent logging in the API to better log exceptions

With this patch we log the actual message of an exception instead of its
str() representation. This allows for consistent error logging in the
API.

Fixes bug: #1224646

Change-Id: I3965bffb1c2c2eee0af440d1ecd30ccb3bb958d5
Merge "Consistent logging in the API to better log exceptions"