           if not $rootScope.$$phase
             $rootScope.$apply()
         collection
-      collection.$finalize = ->
-        collection.$_getPromiseForItems().then ->
+      collection.$finalize = (success=true) ->
+        items_success = success
+        collection.$_getPromiseForItems().then ( ->
           #collection.$meta.async.complete.deferred.resolve(collection)
-          collection.resolvePromise(collection.$meta.async.complete.deferred)
+          collection.resolvePromise(collection.$meta.async.complete.deferred, success)
           collection.$meta.async.complete.resolved = true
+        ), ->
+          items_success = false
+          #collection.$meta.async.complete.deferred.reject(collection)
+          collection.resolvePromise(collection.$meta.async.complete.deferred, items_success)
+          collection.$meta.async.complete.resolved = true
+          collection.$error = true
         #collection.$meta.async.direct.deferred.resolve(collection)
-        collection.resolvePromise(collection.$meta.async.direct.deferred)
+        collection.resolvePromise(collection.$meta.async.direct.deferred, success)
         collection.$meta.async.direct.resolved = true
+        collection.$error = (not (success and items_success))
         collection
       collection
 

        headers: req.headers
        params: req.params
        data: req.data
      ).then (response) =>
        res = @_TransformResponse req, response
        for values in res.data
          collection.push @_MakeInstanceFromRemote(values)
        @_PostResponse res
        collection.$finalize()
      collection

    @Search: (field, value, opts={}) ->

        def = @_getField(name)
        if def.type is @constructor.ManyToMany
          fetchM2M(@, def, promises, collections)
      $q.all(promises).then ( =>
        #@$meta.async.m2m.deferred.resolve(@)
        @resolvePromise(@$meta.async.m2m.deferred)
      ) , =>
        @resolvePromise(@$meta.async.m2m.deferred, false)
      for refs_collection in collections
        refs_collection.$finalize()
      @
