blob: 7c97de0d03b6984e3da3ac64fc64804bd7b029b2 [file] [log] [blame]
Matteo Scandolo889ced32015-11-04 16:07:09 +01001(function() {
2 'use strict';
Matteo Scandolo89b179c2016-03-24 11:38:50 -07003 console.log('XOS Helpers Module')
Matteo Scandolo32f83922016-02-11 09:35:29 -08004 angular.module('bugSnag', []).factory('$exceptionHandler', function () {
5 return function (exception, cause) {
Matteo Scandolo6b7054c2016-02-25 09:17:07 -08006 if( window.Bugsnag ){
7 Bugsnag.notifyException(exception, {diagnostics:{cause: cause}});
8 }
9 else{
10 console.error(exception, cause, exception.stack);
11 }
Matteo Scandolo32f83922016-02-11 09:35:29 -080012 };
13 });
14
Matteo Scandolo889ced32015-11-04 16:07:09 +010015 angular
16 .module('xos.helpers',[
Matteo Scandolo6328d9b2015-11-05 16:02:11 +010017 'ngCookies',
18 'xos.xos',
19 'xos.hpcapi',
Matteo Scandolo32f83922016-02-11 09:35:29 -080020 'xos.xoslib',
Matteo Scandolo89b179c2016-03-24 11:38:50 -070021 'bugSnag',
Matteo Scandolo889ced32015-11-04 16:07:09 +010022 ])
23 .config(config);
24
Matteo Scandolo89b179c2016-03-24 11:38:50 -070025 function config($httpProvider, $interpolateProvider, $resourceProvider) {
26 console.log('xos.helpers config')
Matteo Scandolo889ced32015-11-04 16:07:09 +010027 $httpProvider.interceptors.push('SetCSRFToken');
28
29 $interpolateProvider.startSymbol('{$');
30 $interpolateProvider.endSymbol('$}');
31
32 // NOTE http://www.masnun.com/2013/09/18/django-rest-framework-angularjs-resource-trailing-slash-problem.html
33 $resourceProvider.defaults.stripTrailingSlashes = false;
34 }
35})();