Fail nicely when the config is missing or bad.

Fixes #1.
Abstract the API a bit more.