Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke "Jared" Bennett <lbennett@gitlab.com>2017-04-13 19:17:41 +0300
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-04-13 19:18:19 +0300
commit13b60eb75b99abb23f41c0d899d6e40eefa641cc (patch)
treee0a3d919c659fc302dbbb6c73c0982c490bd998d /app/assets/javascripts/raven
parentcfd3d0fd377c3438c6ce8bc2f20b11f86b43a785 (diff)
[ci skip] Index and singleton improvements with some more unit, more to come
Diffstat (limited to 'app/assets/javascripts/raven')
-rw-r--r--app/assets/javascripts/raven/index.js6
-rw-r--r--app/assets/javascripts/raven/raven_config.js25
2 files changed, 18 insertions, 13 deletions
diff --git a/app/assets/javascripts/raven/index.js b/app/assets/javascripts/raven/index.js
index 6cc81248e6b..373f9f29c79 100644
--- a/app/assets/javascripts/raven/index.js
+++ b/app/assets/javascripts/raven/index.js
@@ -1,10 +1,12 @@
import RavenConfig from './raven_config';
-RavenConfig.init({
+const index = RavenConfig.init.bind(RavenConfig, {
sentryDsn: gon.sentry_dsn,
currentUserId: gon.current_user_id,
whitelistUrls: [gon.gitlab_url],
isProduction: gon.is_production,
});
-export default RavenConfig;
+index();
+
+export default index;
diff --git a/app/assets/javascripts/raven/raven_config.js b/app/assets/javascripts/raven/raven_config.js
index 5510dd2752d..1157a10d96f 100644
--- a/app/assets/javascripts/raven/raven_config.js
+++ b/app/assets/javascripts/raven/raven_config.js
@@ -1,32 +1,35 @@
import Raven from 'raven-js';
+import $ from 'jquery';
-class RavenConfig {
- static init(options = {}) {
+const RavenConfig = {
+ init(options = {}) {
this.options = options;
this.configure();
this.bindRavenErrors();
if (this.options.currentUserId) this.setUser();
- }
- static configure() {
+ return this;
+ },
+
+ configure() {
Raven.config(this.options.sentryDsn, {
whitelistUrls: this.options.whitelistUrls,
environment: this.options.isProduction ? 'production' : 'development',
}).install();
- }
+ },
- static setUser() {
+ setUser() {
Raven.setUserContext({
id: this.options.currentUserId,
});
- }
+ },
- static bindRavenErrors() {
+ bindRavenErrors() {
$(document).on('ajaxError.raven', this.handleRavenErrors);
- }
+ },
- static handleRavenErrors(event, req, config, err) {
+ handleRavenErrors(event, req, config, err) {
const error = err || req.statusText;
Raven.captureMessage(error, {
@@ -40,7 +43,7 @@ class RavenConfig {
event,
},
});
- }
+ },
}
export default RavenConfig;