From 3964af7aded6b8bc7ccc98bc84d9d046426307c9 Mon Sep 17 00:00:00 2001 From: Alexander Corn Date: Wed, 4 Jan 2017 00:07:33 -0500 Subject: [PATCH] Throw a descriptive error if accountName or password is missing in login Closes #119 --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 89471cc..9077823 100644 --- a/index.js +++ b/index.js @@ -56,7 +56,11 @@ function SteamCommunity(options) { } SteamCommunity.prototype.login = function(details, callback) { - if(details.steamguard) { + if (!details.accountName || !details.password) { + throw new Error("Missing either accountName or password to login; both are needed"); + } + + if (details.steamguard) { var parts = details.steamguard.split('||'); this._setCookie(Request.cookie('steamMachineAuth' + parts[0] + '=' + encodeURIComponent(parts[1])), true); }