Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15325221
D9380.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D9380.id.diff
View Options
diff --git a/support/aphlict/client/src/Aphlict.as b/support/aphlict/client/src/Aphlict.as
--- a/support/aphlict/client/src/Aphlict.as
+++ b/support/aphlict/client/src/Aphlict.as
@@ -31,6 +31,10 @@
ExternalInterface.call('JX.Aphlict.didReceiveEvent', type, object);
}
+ protected function error(error:Error):void {
+ this.externalInvoke('error', error.toString());
+ }
+
protected function log(message:String):void {
this.externalInvoke('log', message);
}
diff --git a/support/aphlict/client/src/AphlictMaster.as b/support/aphlict/client/src/AphlictMaster.as
--- a/support/aphlict/client/src/AphlictMaster.as
+++ b/support/aphlict/client/src/AphlictMaster.as
@@ -131,34 +131,38 @@
}
private function didReceiveSocket(event:Event):void {
- var b:ByteArray = this.readBuffer;
- this.socket.readBytes(b, b.length);
+ try {
+ var b:ByteArray = this.readBuffer;
+ this.socket.readBytes(b, b.length);
- do {
- b = this.readBuffer;
- b.position = 0;
+ do {
+ b = this.readBuffer;
+ b.position = 0;
- if (b.length <= 8) {
- break;
- }
+ if (b.length <= 8) {
+ break;
+ }
- var msg_len:Number = parseInt(b.readUTFBytes(8), 10);
- if (b.length >= msg_len + 8) {
- var bytes:String = b.readUTFBytes(msg_len);
- var data:Object = vegas.strings.JSON.deserialize(bytes);
- var t:ByteArray = new ByteArray();
- t.writeBytes(b, msg_len + 8);
- this.readBuffer = t;
-
- // Send the message to all clients.
- for (var client:String in this.clients) {
- this.log('Sending message to client: ' + client);
- this.send.send(client, 'receiveMessage', data);
+ var msg_len:Number = parseInt(b.readUTFBytes(8), 10);
+ if (b.length >= msg_len + 8) {
+ var bytes:String = b.readUTFBytes(msg_len);
+ var data:Object = vegas.strings.JSON.deserialize(bytes);
+ var t:ByteArray = new ByteArray();
+ t.writeBytes(b, msg_len + 8);
+ this.readBuffer = t;
+
+ // Send the message to all clients.
+ for (var client:String in this.clients) {
+ this.log('Sending message to client: ' + client);
+ this.send.send(client, 'receiveMessage', data);
+ }
+ } else {
+ break;
}
- } else {
- break;
- }
- } while (true);
+ } while (true);
+ } catch (err:Error) {
+ this.error(err);
+ }
}
}
diff --git a/webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js b/webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js
--- a/webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js
+++ b/webroot/rsrc/js/application/aphlict/behavior-aphlict-listen.js
@@ -24,25 +24,39 @@
// Respond to a notification from the Aphlict notification server. We send
// a request to Phabricator to get notification details.
function onaphlictmessage(type, message) {
- if (type == 'receive') {
- var routable = new JX.Request('/notification/individual/', onnotification)
- .addData({key: message.key})
- .getRoutable();
+ switch (type) {
+ case 'error':
+ new JX.Notification()
+ .setContent('(Aphlict) ' + message)
+ .alterClassName('jx-notification-error', true)
+ .show();
+ break;
- routable
- .setType('notification')
- .setPriority(250);
+ case 'receive':
+ var routable = new JX.Request(
+ '/notification/individual/',
+ onnotification);
- JX.Router.getInstance().queue(routable);
- } else if (__DEV__) {
- if (config.debug) {
- var details = message ? JX.JSON.stringify(message) : '';
+ routable
+ .addData({key: message.key})
+ .getRoutable();
- new JX.Notification()
- .setContent('(Aphlict) [' + type + '] ' + details)
- .alterClassName('jx-notification-debug', true)
- .show();
- }
+ routable
+ .setType('notification')
+ .setPriority(250);
+
+ JX.Router.getInstance().queue(routable);
+ break;
+
+ default:
+ if (__DEV__ && config.debug) {
+ var details = message ? JX.JSON.stringify(message) : '';
+
+ new JX.Notification()
+ .setContent('(Aphlict) [' + type + '] ' + details)
+ .alterClassName('jx-notification-debug', true)
+ .show();
+ }
}
}
@@ -63,8 +77,7 @@
// If the notification affected an object on this page, show a
// permanent reload notification if we aren't already.
- if ((response.primaryObjectPHID in config.pageObjects) &&
- !showing_reload) {
+ if ((response.primaryObjectPHID in config.pageObjects) && !showing_reload) {
var reload = new JX.Notification()
.setContent('Page updated, click to reload.')
.alterClassName('jx-notification-alert', true)
diff --git a/webroot/rsrc/swf/aphlict.swf b/webroot/rsrc/swf/aphlict.swf
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 8, 2:22 AM (1 d, 14 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7365062
Default Alt Text
D9380.id.diff (5 KB)
Attached To
Mode
D9380: Catch errors that may occur whilst receiving data from the Aphlict server.
Attached
Detach File
Event Timeline
Log In to Comment