Skip to content

Commit b35046a

Browse files
author
Michael Bleigh
committed
Added error message and blog link.
1 parent 5916303 commit b35046a

10 files changed

+72
-17
lines changed

log.coffee

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ mongo.mongoose.model 'Log',
3737
q.where('level',level) if level
3838
q.where('category',category) if category
3939
q.limit(100)
40-
q.sort('created_at',-1)
40+
q.sort({'$natural':-1})
4141
q.all (logs)->
4242
fn(logs)
4343

log.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@
5555
q.where('category', category);
5656
}
5757
q.limit(100);
58-
q.sort('created_at', -1);
58+
q.sort({
59+
'$natural': -1
60+
});
5961
return q.all(function(logs) {
6062
return fn(logs);
6163
});

public/images/failwhale.png

17.3 KB
Loading

public/images/header.png

20.2 KB
Loading

public/stylesheets/application.css

+26
Original file line numberDiff line numberDiff line change
@@ -309,3 +309,29 @@ body.announcement {
309309
display: block; }
310310
body.announcement #nko_vote {
311311
margin-top: 30px; }
312+
313+
#failwhale {
314+
border: 10px solid white;
315+
border-bottom-width: 40px;
316+
-moz-box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.2);
317+
-webkit-box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.2);
318+
box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.2);
319+
filter: "progid:DXImageTransform.Microsoft.dropshadow(OffX=2px, OffY=2px, Color='rgba(0, 0, 0, 0.2)')";
320+
-ms-filter: "\"progid:DXImageTransform.Microsoft.dropshadow(OffX=2px, OffY=2px, Color='rgba(0, 0, 0, 0.2)')\"";
321+
margin: 25px;
322+
-moz-transform: rotate(-5deg);
323+
-o-transform: rotate(-5);
324+
-webkit-transform: rotate(-5deg);
325+
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=-0.014);
326+
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=-0.014)"; }
327+
328+
.error .message {
329+
background-color: #bbbbbb;
330+
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#cccccc), to(#aaaaaa));
331+
background-image: -moz-linear-gradient(top, #cccccc, #aaaaaa);
332+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cccccc', endColorstr='#aaaaaa');
333+
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#cccccc', endColorstr='#aaaaaa')";
334+
-moz-border-radius: 10px;
335+
-webkit-border-radius: 10px;
336+
border-radius: 10px;
337+
padding: 20px; }

public/stylesheets/application.sass

+12-1
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,15 @@ body.announcement
218218
#announcement
219219
display: block
220220
#nko_vote
221-
margin-top: 30px
221+
margin-top: 30px
222+
223+
#failwhale
224+
border: 10px solid white
225+
border-bottom-width: 40px
226+
+box-shadow(2px,2px,15px,rgba(0,0,0,0.2))
227+
margin: 25px
228+
+rotate(-5)
229+
230+
.error .message
231+
+impression
232+
padding: 20px

server.coffee

+10-6
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@ Twitter = require './twitter'
1212
User = require('./user').User
1313
REST = require('./rest').Client
1414
Readability = require('./readability').Client
15-
15+
hoptoad = require('hoptoad-notifier').Hoptoad
16+
1617
# Setup Hoptoad Notification
17-
if process.env.RACK_ENV == 'production'
18-
hoptoad = require('hoptoad-notifier').Hoptoad
19-
hoptoad.key = '63da924b138bae57d1066c46accddbe7'
20-
process.addListener 'uncaughtException', (error)->
21-
hoptoad.notify(error)
2218

2319
# debugging
2420
pp = (obj) -> sys.puts sys.inspect(obj)
@@ -35,6 +31,14 @@ login_required = (req, res, success_callback) ->
3531
app = express.createServer connect.cookieDecoder(), connect.session(), express.staticProvider(__dirname + '/public'), express.logger({ format: ':method :url [:status] (:response-time ms)' })
3632
app.set 'view engine', 'ejs'
3733

34+
app.error (err,req,res,next)->
35+
if process.env.RACK_ENV == 'production'
36+
hoptoad.key = '63da924b138bae57d1066c46accddbe7'
37+
hoptoad.notify(err)
38+
39+
res.render 'error.ejs',
40+
status: 500
41+
3842
app.get '/', (req,res)->
3943
res.render 'splash.ejs'
4044

server.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@
1212
User = require('./user').User;
1313
REST = require('./rest').Client;
1414
Readability = require('./readability').Client;
15-
if (process.env.RACK_ENV === 'production') {
16-
hoptoad = require('hoptoad-notifier').Hoptoad;
17-
hoptoad.key = '63da924b138bae57d1066c46accddbe7';
18-
process.addListener('uncaughtException', function(error) {
19-
return hoptoad.notify(error);
20-
});
21-
}
15+
hoptoad = require('hoptoad-notifier').Hoptoad;
2216
pp = function(obj) {
2317
return sys.puts(sys.inspect(obj));
2418
};
@@ -36,6 +30,15 @@
3630
format: ':method :url [:status] (:response-time ms)'
3731
}));
3832
app.set('view engine', 'ejs');
33+
app.error(function(err, req, res, next) {
34+
if (process.env.RACK_ENV === 'production') {
35+
hoptoad.key = '63da924b138bae57d1066c46accddbe7';
36+
hoptoad.notify(err);
37+
}
38+
return res.render('error.ejs', {
39+
status: 500
40+
});
41+
});
3942
app.get('/', function(req, res) {
4043
return res.render('splash.ejs');
4144
});

views/error.ejs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<h1>Whoops, not enough caffeine.</h1>
2+
3+
<section class='error'>
4+
<p align='center'><img id='failwhale' src='/images/failwhale.png' alt='Fail Whale!'/></p>
5+
6+
<p class='message'>The problem with 48 hour programming competitions is that they're only 48 hours. Looks like you've come across some kind of bug in the system. We've been notified about it, and if we can figure out how we'll fix it. Thanks!</p>
7+
</section>

views/layout.ejs

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
<%- body %>
2222
</div>
2323
<footer id='content_bottom'>
24-
<span>Copyright &copy; 2010 <a href='http://github.com/mbleigh'>Michael Bleigh</a>, <a href='http://github.com/ssoper'>Sean Soper</a>, and <a href='http://github.com/jch'>Jerry Cheung</a>. Built for the <a href='http://nodeknockout.com/teams/flockfeed'>Node Knockout</a>.</span>
24+
<span>Copyright &copy; 2010 <a href='http://www.intridea.com/'>Intridea, Inc.</a>. Built for the <a href='http://nodeknockout.com/teams/flockfeed'>Node Knockout</a>.</span>
2525
<dl>
2626
<dt>Email:</dt>
2727
<dd><a href='mailto:flockfeeds@intridea.com'>flockfeeds@intridea.com</a></dd>
2828
<dt>Twitter:</dt>
2929
<dd><a href='http://twitter.com/flockfeeds' target='_blank'>@flockfeeds</a>
30+
<dt>Blog:</dt>
31+
<dd><a href='http://flockfeeds.tumblr.com/'>Tumblr</a>
3032
</dl>
3133
</footer>
3234
</div>

0 commit comments

Comments
 (0)