Skip to content

Commit

Permalink
Merge pull request #2702 from kobotoolbox/2450-improved-error-message
Browse files Browse the repository at this point in the history
get a better error message from Raven
  • Loading branch information
jnm authored Jul 20, 2020
2 parents 13e1248 + b322369 commit 8424a6a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions jsapp/xlform/src/view.surveyApp.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ module.exports = do ->
_notifyIfRowsOutOfOrder = do ->
# a temporary function to notify devs if rows are mysteriously falling out of order
fn = (surveyApp)->
if surveyApp.orderfail
# it's already been reported so no need to report it again
return
survey = surveyApp.survey
elIds = []
surveyApp.$('.survey__row').each -> elIds.push $(@).data('rowId')
Expand All @@ -30,9 +33,13 @@ module.exports = do ->

_s = (i)-> JSON.stringify(i)
if _s(rIds) isnt _s(elIds)
Raven?.captureException new Error('Row model does not match view'), extra:
rIds: _s(rIds)
elIds: _s(elIds)
pathname = window.location.pathname
surveyApp.orderfail = true
err_message = """
Row model does not match view: #{_s(rIds)} #{_s(elIds)} #{pathname}
""".trim()
console?.error(err_message)
Raven?.captureException new Error(err_message)

false
else
Expand Down

0 comments on commit 8424a6a

Please sign in to comment.