refactor(errors): move error calls and output to error class

This is the start of a better wrapper to handle errors. It also
prints error text to stderr instead of stdout.
@unihorn Done.