You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.
What is the correct way to catch errors on login? If someone enters incorrect credentials, the module throws an error, but I'm unable to catch them and the script crashes. Has anyone successfully done this?
/opt/bitnami/apache2/htdocs/node_modules/robinhood/src/robinhood.js:141
throw new Error(
^
Error: token not found {"statusCode":400,"body":{"detail":"Unable to log in with provided credentials."},"headers":{"date":"Fri, 14 Sep 2018 00:55:06 GMT","content-type":"application/json","content-length":"56","connection":"keep-alive","server":"nginx","content-language":"en-us","x-robinhood-api-version":"1.244.14","vary":"Accept-Language, Cookie","allow":"POST, OPTIONS"},"request":{"uri":{"protocol":"https:","slashes":true,"auth":null,"host":"api.robinhood.com","port":443,"hostname":"api.robinhood.com","hash":null,"search":null,"query":null,"pathname":"/oauth2/token/","path":"/oauth2/token/","href":"https://api.robinhood.com/oauth2/token/"},"method":"POST","headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate","Accept-Language":"en;q=1, fr;q=0.9, de;q=0.8, ja;q=0.7, nl;q=0.6, it;q=0.5","Content-Type":"application/x-www-form-urlencoded; charset=utf-8","Connection":"keep-alive","X-Robinhood-API-Version":"1.152.0","User-Agent":"Robinhood/5.32.0 (com.robinhood.release.Robinhood; build:3814; iOS 10.3.3)","content-length":134}}}
at Request._callback (/opt/bitnami/apache2/htdocs/node_modules/robinhood/src/robinhood.js:141:17)
at Request.self.callback (/opt/bitnami/apache2/htdocs/node_modules/request/request.js:185:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request.<anonymous> (/opt/bitnami/apache2/htdocs/node_modules/request/request.js:1161:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage.<anonymous> (/opt/bitnami/apache2/htdocs/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
The text was updated successfully, but these errors were encountered:
callback(newAuthenticationError('token missing from response body'))
and
// wrap the network/request errors with VErrorcallback(newVError(err,'failed to fetch account'))// line 164/155callback(newVError(err,'failed to perform login call'))// line 137
Could be an easy enough PR, but also a breaking change since the login callback would now become callback(error, data) instead of the current callback(data). This would be a good thing since the former is the correct Node.js convention.
What is the correct way to catch errors on login? If someone enters incorrect credentials, the module throws an error, but I'm unable to catch them and the script crashes. Has anyone successfully done this?
Code being executed:
The text was updated successfully, but these errors were encountered: