Clean up JS error tracking

pull/447/merge
Thibaut Courouble 9 years ago
parent 0d38b9be88
commit 2a7107f94b

@ -1,7 +1,4 @@
@app = @app =
_$: $
_$$: $$
_page: page
collections: {} collections: {}
models: {} models: {}
templates: {} templates: {}
@ -53,18 +50,11 @@
Raven.config @config.sentry_dsn, Raven.config @config.sentry_dsn,
whitelistUrls: [/devdocs/] whitelistUrls: [/devdocs/]
includePaths: [/devdocs/] includePaths: [/devdocs/]
ignoreErrors: [/dpQuery/, /NPObject/, /NS_ERROR/, /^null$/] ignoreErrors: [/NPObject/, /NS_ERROR/, /^null$/]
tags: tags:
mode: if @DOC then 'single' else 'full' mode: if @isSingleDoc() then 'single' else 'full'
iframe: (window.top isnt window).toString() iframe: (window.top isnt window).toString()
shouldSendCallback: => shouldSendCallback: => not @isAndroidWebview()
try
if @isInjectionError()
@onInjectionError()
return false
if @isAndroidWebview()
return false
true
dataCallback: (data) -> dataCallback: (data) ->
try try
$.extend(data.user ||= {}, app.settings.dump()) $.extend(data.user ||= {}, app.settings.dump())
@ -201,32 +191,16 @@
return if @quotaExceeded return if @quotaExceeded
@quotaExceeded = true @quotaExceeded = true
new app.views.Notif 'QuotaExceeded', autoHide: null new app.views.Notif 'QuotaExceeded', autoHide: null
Raven.captureMessage 'QuotaExceededError' Raven.captureMessage 'QuotaExceededError', level: 'warning'
onWindowError: (args...) -> onWindowError: (args...) ->
if @isInjectionError args... return unless @isAppError args...
@onInjectionError() @previousErrorHandler? args...
else if @isAppError args... @hideLoading()
@previousErrorHandler? args... @errorNotif or= new app.views.Notif 'Error'
@hideLoading() @errorNotif.show()
@errorNotif or= new app.views.Notif 'Error'
@errorNotif.show()
return
onInjectionError: ->
unless @injectionError
@injectionError = true
alert """
JavaScript code has been injected in the page which prevents DevDocs from running correctly.
Please check your browser extensions/addons. """
Raven.captureMessage 'injection error'
return return
isInjectionError: ->
# Some browser extensions expect the entire web to use jQuery.
# I gave up trying to fight back.
window.$ isnt app._$ or window.$$ isnt app._$$ or window.page isnt app._page or typeof $.empty isnt 'function' or typeof page.show isnt 'function'
isAppError: (error, file) -> isAppError: (error, file) ->
# Ignore errors from external scripts. # Ignore errors from external scripts.
file and file.indexOf('devdocs') isnt -1 and file.indexOf('.js') is file.length - 3 file and file.indexOf('devdocs') isnt -1 and file.indexOf('.js') is file.length - 3
@ -243,12 +217,12 @@
cssGradients: supportsCssGradients() cssGradients: supportsCssGradients()
for key, value of features when not value for key, value of features when not value
Raven.captureMessage "unsupported/#{key}" Raven.captureMessage "unsupported/#{key}", level: 'info'
return false return false
true true
catch error catch error
Raven.captureMessage 'unsupported/exception', extra: { error: error } Raven.captureMessage 'unsupported/exception', level: 'info', extra: { error: error }
false false
isSingleDoc: -> isSingleDoc: ->

@ -297,7 +297,7 @@ class app.DB
@cachedDocs[doc] = false @cachedDocs[doc] = false
store.delete(doc) store.delete(doc)
return return
Raven.captureMessage 'corruptedDocs', extra: { docs: @corruptedDocs.join(',') } Raven.captureMessage 'corruptedDocs', level: 'info', extra: { docs: @corruptedDocs.join(',') }
return return
shouldLoadWithIDB: (entry) -> shouldLoadWithIDB: (entry) ->

Loading…
Cancel
Save