blob: eb9222c02c3b87b9a7a0e4b3ac93487bcb33db27 [file] [log] [blame]
Matteo Scandolo889ced32015-11-04 16:07:09 +01001(function() {
Matteo Scandolo2ef0cd72016-04-12 11:59:29 -07002 'use strict';
3 console.log('XOS Helpers Module')
4 angular.module('bugSnag', []).factory('$exceptionHandler', function () {
5 return function (exception, cause) {
6 if( window.Bugsnag ){
7 Bugsnag.notifyException(exception, {diagnostics: {cause: cause}});
8 }
9 else{
10 console.error(exception, cause, exception.stack);
11 }
12 };
13 });
Matteo Scandolo32f83922016-02-11 09:35:29 -080014
Matteo Scandolo2ef0cd72016-04-12 11:59:29 -070015 angular
16 .module('xos.helpers', [
17 'ngCookies',
18 'ngResource',
19 'bugSnag',
20 'xos.uiComponents'
21 ])
22 .config(config);
Matteo Scandolo889ced32015-11-04 16:07:09 +010023
Matteo Scandolo2ef0cd72016-04-12 11:59:29 -070024 function config($httpProvider, $interpolateProvider, $resourceProvider) {
25 $httpProvider.interceptors.push('SetCSRFToken');
Matteo Scandolo889ced32015-11-04 16:07:09 +010026
Matteo Scandolo2ef0cd72016-04-12 11:59:29 -070027 $interpolateProvider.startSymbol('{$');
28 $interpolateProvider.endSymbol('$}');
Matteo Scandolo889ced32015-11-04 16:07:09 +010029
Matteo Scandolo2ef0cd72016-04-12 11:59:29 -070030 // NOTE http://www.masnun.com/2013/09/18/django-rest-framework-angularjs-resource-trailing-slash-problem.html
31 $resourceProvider.defaults.stripTrailingSlashes = false;
32 }
Matteo Scandolo889ced32015-11-04 16:07:09 +010033})();