Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDragon endpoint error if version() is not specified #60

Closed
M0kY opened this issue Dec 25, 2018 · 3 comments
Closed

DDragon endpoint error if version() is not specified #60

M0kY opened this issue Dec 25, 2018 · 3 comments

Comments

@M0kY
Copy link

M0kY commented Dec 25, 2018

Version:

0.9.1

Steps to reproduce:

The following code, taken from the docs:

kayn.DDragon.Champion.list() // Implicitly targets 8.15.1
    .callback(function(error, champions) {
        console.log(champions)
    })

Expected:

Expected to return an object containing all champions data.

Result:

(node:8844) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of null
    at DDragonRequest.<anonymous> (C:\rito_api\node_modules\kayn\dist\lib\RequestClient\DDragonRequest.js:144:44)
    at Generator.next (<anonymous>)
    at step (C:\rito_api\node_modules\kayn\dist\lib\RequestClient\DDragonRequest.js:18:191)
    at C:\rito_api\node_modules\kayn\dist\lib\RequestClient\DDragonRequest.js:18:437
    at new Promise (<anonymous>)
    at DDragonRequest.<anonymous> (C:\rito_api\node_modules\kayn\dist\lib\RequestClient\DDragonRequest.js:18:99)
    at DDragonRequest.callback (C:\rito_api\node_modules\kayn\dist\lib\RequestClient\DDragonRequest.js:164:21)
    at main (C:\rito_api\index.js:31:6)
    at Object.<anonymous> (C:\rito_api\index.js:62:1)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
(node:8844) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8844) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

After adding .version('8.15.1') to the initial code the result is the expected champion data.

@cnguy
Copy link
Owner

cnguy commented Dec 25, 2018

Good catch!

This error occurs when the developer is not using a cache (so cache: null). Well, technically, the error occurs because of bad programming by me. I'll release a fix in an hour!

cnguy added a commit that referenced this issue Dec 25, 2018
cnguy added a commit that referenced this issue Dec 25, 2018
cnguy added a commit that referenced this issue Dec 25, 2018
@cnguy
Copy link
Owner

cnguy commented Dec 25, 2018

@M0kY
Copy link
Author

M0kY commented Dec 25, 2018

Awesome, thank you very much for the quick fix.

@cnguy cnguy closed this as completed Dec 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants