1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 16:58:48 +02:00

Install an uncaught exception handler in Aphlict

Summary:
Ref T5373. This seems to work pretty much correctly.

Also stop popping bubbles and just use the log, since users find the bubbles confusing/not useful and they're not great for developers either.

Future diffs will expose more user-facing stuff.

Test Plan: Added `throw` to AphlictClient.as, got a log in the parent window.

Reviewers: joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T5373

Differential Revision: https://secure.phabricator.com/D9698
This commit is contained in:
epriestley 2014-06-23 15:18:36 -07:00
parent 46d9bebc84
commit 80f26e96ea
4 changed files with 15 additions and 17 deletions

View file

@ -34,7 +34,7 @@ package {
ExternalInterface.call('JX.Aphlict.didReceiveEvent', type, object);
}
final protected function error(error:Error):void {
final protected function error(error:Object):void {
this.externalInvoke('error', error.toString());
}

View file

@ -4,7 +4,7 @@ package {
import flash.external.ExternalInterface;
import flash.utils.Dictionary;
import flash.utils.Timer;
import flash.events.UncaughtErrorEvent;
final public class AphlictClient extends Aphlict {
@ -37,6 +37,10 @@ package {
public function AphlictClient() {
super();
loaderInfo.uncaughtErrorEvents.addEventListener(
UncaughtErrorEvent.UNCAUGHT_ERROR,
this.uncaughtErrorHandler);
ExternalInterface.addCallback('connect', this.externalConnect);
ExternalInterface.call(
'JX.Stratcom.invoke',
@ -45,6 +49,10 @@ package {
{});
}
private function uncaughtErrorHandler(event:UncaughtErrorEvent):void {
this.error(event.error.toString());
}
public function externalConnect(
server:String,
port:Number,

View file

@ -8,6 +8,7 @@
* javelin-dom
* javelin-json
* javelin-router
* javelin-util
* phabricator-notification
*/
@ -54,28 +55,17 @@ JX.behavior('aphlict-listen', function(config) {
// a request to Phabricator to get notification details.
function onaphlictmessage(type, message) {
switch (type) {
case 'error':
new JX.Notification()
.setContent('(Aphlict) ' + message)
.alterClassName('jx-notification-error', true)
.setDuration(0)
.show();
break;
case 'receive':
JX.Stratcom.invoke('aphlict-receive-message', null, message);
break;
default:
if (__DEV__ && config.debug) {
case 'error':
if (config.debug) {
var details = message ? JX.JSON.stringify(message) : '';
new JX.Notification()
.setContent('(Aphlict) [' + type + '] ' + details)
.alterClassName('jx-notification-debug', true)
.setDuration(3000)
.show();
JX.log('(Aphlict) [' + type + '] ' + details);
}
break;
}
}

Binary file not shown.