API methods should provide errors instead of exit

Resolved #24