Skip to content

Commit eb735cb

Browse files
committed
🎨 Make status bar have an api for fatal's
https://cldup.com/PGKQawQtnZ.png
1 parent 2eaa856 commit eb735cb

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

src/app.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,12 @@ var Application = View.extend({
123123
app.statusbar.hide();
124124
},
125125
onFatalError: function(id, err) {
126+
debug('clearing client stall timeout...');
127+
clearTimeout(this.clientStalledTimeout);
128+
126129
console.error('Fatal Error!: ', id, err);
127-
bugsnag.notifyException(err, 'fatal!' + id);
128-
window.alert('Fatal Error: ' + id + ': ' + err.message);
130+
bugsnag.notifyException(err, 'Fatal Error: ' + id);
131+
app.statusbar.fatal(err);
129132
},
130133
// ms we'll wait for a `scout-client` instance
131134
// to become readable before giving up and showing

src/statusbar/index.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
.progress-bar.progress-bar-striped.active(data-hook='inner-bar')
44
ul.message-background.with-sidebar.centered(data-hook='message-container'): li
55
p(data-hook='message')
6-
.spinner-circles
6+
.spinner-circles(data-hook='loading')
77
.circle-1
88
.circle-2

src/statusbar/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,20 @@ var StatusbarView = View.extend({
77
},
88
message: {
99
type: 'string'
10+
},
11+
loading: {
12+
type: 'boolean',
13+
default: true
1014
}
1115
},
1216
template: require('./index.jade'),
1317
bindings: {
18+
loading: {
19+
hook: 'loading',
20+
type: 'booleanClass',
21+
yes: 'visible',
22+
no: 'hidden'
23+
},
1424
message: [
1525
{
1626
hook: 'message'
@@ -68,13 +78,20 @@ var StatusbarView = View.extend({
6878
onComplete: function() {
6979
this.hide();
7080
},
81+
fatal: function(err) {
82+
this.loading = false;
83+
this.message = 'Fatal Error: ' + err.message;
84+
this.width = 100;
85+
},
7186
show: function(message) {
7287
this.message = message || '';
7388
this.width = 100;
89+
this.loading = true;
7490
},
7591
hide: function() {
7692
this.message = '';
7793
this.width = 0;
94+
this.loading = false;
7895
}
7996
});
8097

0 commit comments

Comments
 (0)