File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ const DEFAULT_PORT = 8080;
44const DEFAULT_LIVERELOAD_PORT = 35729 ;
55const DEFAULT_DEV_ASSETS_MAX_AGE = 0 ;
66const DEFAULT_PROD_ASSETS_MAX_AGE = 1000 * 60 * 60 * 24 * 365 ; // 1 year, in ms
7+ const SENTRY_DSN = process . env . SENTRY_DSN ;
8+ const SENTRY_LEVEL = process . env . SENTRY_LEVEL ;
79
810// native
911var fs = require ( 'fs' ) ;
@@ -26,6 +28,7 @@ handlebars_helper.help( Handlebars );
2628var express_handlebars = require ( 'express3-handlebars' ) ;
2729var chokidar = require ( 'chokidar' ) ;
2830var glob = require ( 'glob' ) ;
31+ var raven = require ( 'raven' ) ;
2932
3033// our party! \o/
3134var Page = require ( './page.js' ) ;
@@ -99,6 +102,14 @@ var SolidusServer = function( options ){
99102 } ) ) ;
100103 // catch-all middleware at the end of the stack for 404 handling
101104 router . use ( router . router ) ;
105+ // log express errors to sentry if defined
106+ if ( SENTRY_DSN ) {
107+ router . use ( raven . middleware . express ( SENTRY_DSN ) ) ;
108+ var raven_client = solidus_server . raven_client = new raven . Client ( SENTRY_DSN ) ;
109+ raven_client . patchGlobal ( function ( ) {
110+ process . exit ( 1 ) ;
111+ } ) ;
112+ }
102113 router . use ( function ( req , res , next ) {
103114 res . status ( 404 ) ;
104115 // it's cheaper to check this than to fs.exists the notfound path
Original file line number Diff line number Diff line change 3434 "glob" : " ~3.2.6" ,
3535 "handlebars" : " ~1.0.12" ,
3636 "handlebars-helper" : " ~0.0.9" ,
37- "worker-farm" : " ~0.3.1"
37+ "worker-farm" : " ~0.3.1" ,
38+ "raven" : " ^0.6.2"
3839 },
3940 "devDependencies" : {
4041 "mocha" : " ~1.9.0" ,
You can’t perform that action at this time.
0 commit comments