Return Go errors instead of ints

Closes #4