From 201a1bfd23f243f4c43419b22568847422c6bf24 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 11 Sep 2018 17:10:06 -0400 Subject: [PATCH] return false when provider not set --- src/messages.js | 3 +++ src/storage.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/messages.js b/src/messages.js index 680496b..0a7392f 100644 --- a/src/messages.js +++ b/src/messages.js @@ -20,6 +20,9 @@ Messages.setProvider = function (providerName, options) { }; Messages.isAvailable = function () { + if (!this.currentMessages) { + return false; + } return this.currentMessages.isAvailable(); }; diff --git a/src/storage.js b/src/storage.js index cb97a21..adbf626 100644 --- a/src/storage.js +++ b/src/storage.js @@ -66,7 +66,7 @@ Storage.setProvider = function (providerName, options) { Storage.isAvailable = function () { if (!this.currentStorage) { - throw new Error(this.noProviderError); + return false; } return this.currentStorage.isAvailable(); };