From 84d39c4a14759cab60bd228c11254d18ccdb7b19 Mon Sep 17 00:00:00 2001 From: Brian Carstensen Date: Wed, 19 Dec 2012 07:44:30 -0600 Subject: [PATCH] Fail slightly more gracefully --- app/models/subject.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/subject.coffee b/app/models/subject.coffee index d2a30f9..f5fbdab 100644 --- a/app/models/subject.coffee +++ b/app/models/subject.coffee @@ -42,9 +42,13 @@ class Subject extends Model # Grab subjects randomly. getter = Api.get("/projects/serengeti/groups/subjects?limit=#{count}").deferred + getter.done (rawSubjects) => fetcher.resolve (@fromJSON rawSubject for rawSubject in rawSubjects) + getter.fail => + fetcher.resolve [] + fetcher.promise() # Resolves with all fetched subjects @fromJSON: (raw) =>