mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #125 from sharelatex/clientside-error-logging
Clientside error logging
This commit is contained in:
commit
b260287965
7 changed files with 49 additions and 2 deletions
2
services/web/.gitignore
vendored
2
services/web/.gitignore
vendored
|
@ -68,4 +68,4 @@ Gemfile.lock
|
||||||
|
|
||||||
app/views/external
|
app/views/external
|
||||||
|
|
||||||
modules
|
/modules/
|
||||||
|
|
|
@ -126,6 +126,8 @@ module.exports = (app)->
|
||||||
delete req.session.justLoggedIn
|
delete req.session.justLoggedIn
|
||||||
res.locals.gaToken = Settings.analytics?.ga?.token
|
res.locals.gaToken = Settings.analytics?.ga?.token
|
||||||
res.locals.tenderUrl = Settings.tenderUrl
|
res.locals.tenderUrl = Settings.tenderUrl
|
||||||
|
res.locals.sentrySrc = Settings.sentry?.src
|
||||||
|
res.locals.sentryPublicDSN = Settings.sentry?.publicDSN
|
||||||
next()
|
next()
|
||||||
|
|
||||||
app.use (req, res, next) ->
|
app.use (req, res, next) ->
|
||||||
|
|
|
@ -47,6 +47,24 @@ html(itemscope, itemtype='http://schema.org/Product')
|
||||||
block scripts
|
block scripts
|
||||||
script(src="#{jsPath}libs/jquery-1.11.1.min.js")
|
script(src="#{jsPath}libs/jquery-1.11.1.min.js")
|
||||||
script(src="#{jsPath}libs/angular-1.3.0-beta.14.min.js")
|
script(src="#{jsPath}libs/angular-1.3.0-beta.14.min.js")
|
||||||
|
- if (typeof(sentrySrc) != "undefined")
|
||||||
|
- if (sentrySrc.match(/^([a-z]+:)?\/\//i))
|
||||||
|
script(src="#{sentrySrc}")
|
||||||
|
- else
|
||||||
|
script(src="#{jsPath}libs/#{sentrySrc}")
|
||||||
|
- if (typeof(sentrySrc) != "undefined")
|
||||||
|
script(type="text/javascript").
|
||||||
|
if (typeof(Raven) != "undefined" && Raven.config) {
|
||||||
|
Raven.config("#{sentryPublicDSN}", {
|
||||||
|
// we highly recommend restricting exceptions to a domain in order to filter out clutter
|
||||||
|
// whitelistUrls: ['example.com/scripts/']
|
||||||
|
}).install();
|
||||||
|
}
|
||||||
|
- if (typeof(user) != "undefined" && typeof (user.email) != "undefined")
|
||||||
|
script(type="text/javascript").
|
||||||
|
if (typeof(Raven) != "undefined" && Raven.setUserContext) {
|
||||||
|
Raven.setUserContext({email: '#{user.email}'});
|
||||||
|
}
|
||||||
|
|
||||||
script.
|
script.
|
||||||
window.sharelatex = {
|
window.sharelatex = {
|
||||||
|
|
|
@ -203,7 +203,15 @@ module.exports =
|
||||||
# ShareLaTeX's help desk is provided by tenderapp.com
|
# ShareLaTeX's help desk is provided by tenderapp.com
|
||||||
# tenderUrl: ""
|
# tenderUrl: ""
|
||||||
#
|
#
|
||||||
|
# Client-side error logging is provided by getsentry.com
|
||||||
|
# sentry:
|
||||||
|
# src: ""
|
||||||
|
# publicDSN: ""
|
||||||
|
#
|
||||||
|
# src should be either a remote url like
|
||||||
|
# //cdn.ravenjs.com/1.1.16/jquery,native/raven.min.js
|
||||||
|
# or a local file in the js/libs directory.
|
||||||
|
# The publicDSN is the token for the client-side getSentry service.
|
||||||
|
|
||||||
# Production Settings
|
# Production Settings
|
||||||
# -------------------
|
# -------------------
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
define [
|
define [
|
||||||
"libs"
|
"libs"
|
||||||
"modules/recursionHelper"
|
"modules/recursionHelper"
|
||||||
|
"modules/errorCatcher"
|
||||||
"utils/underscore"
|
"utils/underscore"
|
||||||
], () ->
|
], () ->
|
||||||
App = angular.module("SharelatexApp", [
|
App = angular.module("SharelatexApp", [
|
||||||
|
@ -11,6 +12,7 @@ define [
|
||||||
"underscore"
|
"underscore"
|
||||||
"ngSanitize"
|
"ngSanitize"
|
||||||
"ipCookie"
|
"ipCookie"
|
||||||
|
"ErrorCatcher"
|
||||||
])
|
])
|
||||||
|
|
||||||
return App
|
return App
|
||||||
|
|
14
services/web/public/coffee/modules/errorCatcher.coffee
Normal file
14
services/web/public/coffee/modules/errorCatcher.coffee
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
app = angular.module 'ErrorCatcher', []
|
||||||
|
|
||||||
|
app.config ['$provide', ($provide) ->
|
||||||
|
$provide.decorator '$exceptionHandler', ['$log', '$delegate', ($log, $delegate) ->
|
||||||
|
return (exception, cause) ->
|
||||||
|
if (Raven?.captureException?)
|
||||||
|
Raven.captureException exception;
|
||||||
|
$delegate(exception, cause)
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
# TODO: add support for an errorHttpInterceptor to catch failing ajax
|
||||||
|
# requests as described at
|
||||||
|
# http://bahmutov.calepin.co/catch-all-errors-in-angular-app.html
|
3
services/web/public/js/libs/raven-1.1.16.min.js
vendored
Normal file
3
services/web/public/js/libs/raven-1.1.16.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue