Skip to content

Commit

Permalink
Small changes to error handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitar committed Sep 20, 2019
1 parent 3799cdf commit a4044e8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions server.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -185,20 +185,23 @@ extendPublish (name, publishFunction, options) ->
# and that you can return cursors from the function which would be automatically published.
publish.autorun = (runFunc) ->
handle = Tracker.autorun (computation) ->
computation.onInvalidate ->
delete allCollectionNames[computation._id]

try
result = runFunc.call publish, computation
catch e
catch error
computation.stop()

if computation.firstRun
throw e
throw error
else
publish.error(e)
publish.error(error)
return

collectionNames = getCollectionNames result
allCollectionNames[computation._id] = collectionNames

computation.onInvalidate ->
delete allCollectionNames[computation._id]

unless checkNames publish, allCollectionNames, "#{computation._id}", collectionNames
computation.stop()
return
Expand Down

0 comments on commit a4044e8

Please sign in to comment.