'use strict'

angular.module('payrollhero.api').service 'PhApiHelper', ->
  @errorMessageFor= (error) ->
    switch error.status
      when 0
      #general error, lack of CORS probably.  We got zero response from the server or it was cancelled.
        "an unknown server error occurred!"
      when 422
      #Something missing, present the error message to the user.
        error.data.error_description
      else
      # generalize this later.
        "an unknown server error occurred!"

  return
