Skip to content

Commit

Permalink
Rethrow exceptions for a better resolution to #9
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhoo committed Nov 10, 2011
1 parent c7deb35 commit 881a6cd
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions postmessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,14 @@ var NO_JQUERY = {};
}
continue;
}

function sendReply ( data ) {
if (msg.callback) {
pm.send({target:e.source, data:data, type:msg.callback});
}
}

try {
function sendReply ( data ) {
if (msg.callback) {
pm.send({target:e.source, data:data, type:msg.callback});
}
}

if ( o.callback ) {
o.fn(msg.data, sendReply, e);
} else {
Expand All @@ -254,6 +255,8 @@ var NO_JQUERY = {};
if (msg.errback) {
// notify post message errback
pm.send({target:e.source, data:ex, type:msg.errback});
} else {
throw ex;
}
}
};
Expand Down Expand Up @@ -381,13 +384,14 @@ var NO_JQUERY = {};
continue;
}
}

function sendReply ( data ) {
if (msg.callback) {
pm.send({target:source_window, data:data, type:msg.callback, hash:true, url:hash.source.url});
}
}

try {
function sendReply ( data ) {
if (msg.callback) {
pm.send({target:source_window, data:data, type:msg.callback, hash:true, url:hash.source.url});
}
}

if ( o.callback ) {
o.fn(msg.data, sendReply);
} else {
Expand All @@ -398,6 +402,8 @@ var NO_JQUERY = {};
if (msg.errback) {
// notify post message errback
pm.send({target:source_window, data:ex, type:msg.errback, hash:true, url:hash.source.url});
} else {
throw ex;
}
}
};
Expand Down

0 comments on commit 881a6cd

Please sign in to comment.