Skip to content

Commit

Permalink
Make sendToParent async throw errow if there is no parent
Browse files Browse the repository at this point in the history
- Avoid needing to catch sync and async errors for this function
  • Loading branch information
bryclee committed Jul 18, 2016
1 parent 548ac63 commit b76b0cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/interface/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ export function sendToParent(name, data, options, callback) {

let win = getParentWindow();

if (!window) {
throw new Error('Window does not have a parent');
if (!win) {
return new promise.Promise((resolve, reject) => reject(new Error('Window does not have a parent')));
}

return send(win, name, data, options, callback);
Expand Down

0 comments on commit b76b0cf

Please # to comment.