Refactor errors.coffee