From b76b0cf9a9160d77bfe751e95284dde9e4652331 Mon Sep 17 00:00:00 2001 From: Bryan Lee Date: Mon, 18 Jul 2016 14:15:52 -0700 Subject: [PATCH] Make sendToParent async throw errow if there is no parent - Avoid needing to catch sync and async errors for this function --- src/interface/client.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/interface/client.js b/src/interface/client.js index 02b4f631..93722d07 100644 --- a/src/interface/client.js +++ b/src/interface/client.js @@ -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);