CFY-750 added error codes to REST service; refactored error handling