Skip to content

Commit

Permalink
Fixing Instagram config error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
zobalogh committed Oct 31, 2014
1 parent d21f734 commit 614066b
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions instagram/instagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,13 @@ module.exports = function(RED) {

// the query node doesn't require special initialization as it serves the latest photo anyway
function initializeQueryNode(node) {
if(!node.instagramConfig.credentials.access_token) {
node.warn("Missing Instagram access token. Authorization has not been completed before node initialization.");
if(node.instagramConfig && node.instagramConfig.credentials) {
if(!node.instagramConfig.credentials.access_token) {
node.warn("Missing Instagram access token. Authorization has not been completed before node initialization.");
return;
}
} else {
node.warn("Missing Instagram configuration or credentials. Authorization has not been completed before node initialization.");
return;
}

Expand All @@ -56,8 +61,13 @@ module.exports = function(RED) {

// we initialize the node: load access token, obtain current state from Instagram
function initializeInputNode(node) {
if(!node.instagramConfig.credentials.access_token) {
node.warn("Missing Instagram access token. Authorization has not been completed before node initialization.");
if(node.instagramConfig && node.instagramConfig.credentials) {
if(!node.instagramConfig.credentials.access_token) {
node.warn("Missing Instagram access token. Authorization has not been completed before node initialization.");
return;
}
} else {
node.warn("Missing Instagram configuration or credentials. Authorization has not been completed before node initialization.");
return;
}

Expand Down

0 comments on commit 614066b

Please sign in to comment.