api: logging error and returning friendly error msg to user

Fixes #8.