Error handling

Using $q.reject on error