Skip to content

Commit

Permalink
Fail slightly more gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-c committed Dec 19, 2012
1 parent 7b33d7b commit 84d39c4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/subject.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down

0 comments on commit 84d39c4

Please sign in to comment.