Comments (3)
This is a tricky one to follow, so I will do my best to lay out the sequence of events stating with the first failure.
The process throws the expected error about requiring a version since it cannot look it up using the realms endpoint:
kayn/lib/RequestClient/DDragonRequest.js
Lines 47 to 53 in fe34048
This error makes its way up to the try/catch block where it calls the error
function:
kayn/lib/RequestClient/DDragonRequest.js
Lines 252 to 255 in fe34048
The error function then passes a NULL
data
parameter to the callback at:
kayn/lib/RequestClient/DDragonRequest.js
Lines 178 to 181 in fe34048
It then errors a second time when it cannot destructure the NULL
value. This is the error that the user sees, instead of the proper version error from the beginning.
After fiddling with it for a while, the easiest solution I could come up with was simply removing both of the try/catch blocks and letting the original error make its way back to the user. This resulted in me getting the version error that I would expect and stopped the detructuring callback from being called multiple times. If we wanted to make it actually work with an optional version we could perhaps have a fallback to use the latest version gotten from the versions endpoint. This would be useful since that was my expected behavior.
from kayn.
Awesome... the Realms endpoint seems to contain the old rune/mastery versions as well.. I wonder if there is an issue that is already raised..
{ item: '9.16.1',
rune: '7.23.1',
mastery: '7.23.1',
summoner: '9.16.1',
champion: '9.16.1',
profileicon: '9.16.1',
map: '9.16.1',
language: '9.16.1',
sticker: '9.16.1' },
as well... Obviously, if we wanted a hacky implementaiton, we could just tell it to use the same version as the others, but the versions can differ, too, so that'd probably be buggy..
Here is a comment I found on Discord:
I suppose we could just use the latest version, or just bubble up the error while also noting that optional versions does not work specifically for this endpoint. Note how there's no error checking here. Perhaps I can just re-throw the error (I forgot if this will get caught by an internal try/catch, so I'll check later).
self.execute(url, true, function(err, data) {
if (err) { throw error }
const { n: versions } = data
executeWithVersion(endpoint, versions)
})
from kayn.
It does get caught by your internal try/catch block. It runs that block multiple times. The first time through, you have the data
set to the proper object above, so it can destructure it. executeWithVersion
errors properly once it cannot find the runesReforged endpoint. That gets caught by the error handler, which calls the callback again. This time, with data
being NULL. That is the error that finally gets passed back up. If we remove or refactor the error handling, the proper error will bubble up.
from kayn.
Related Issues (20)
- Grab Spell by his id/key
- Match-V5 Support HOT 1
- /typings/index.d.ts(293,1): error TS1046: A 'declare' modifier is required for a top level declaration in a .d.ts file. HOT 3
- v0.9.4 rate limiter may be broken HOT 2
- summoner/v3 endpoint returning forbidden HOT 2
- positional rank endpoints HOT 1
- Positional Rank Endpoints HOT 1
- Positional Ranking Deprecation HOT 2
- Does Kayn respect custom rate limit? HOT 2
- Minor unnecessary import in index.d.ts HOT 5
- Current games issue HOT 9
- Current LeaguePositions issue HOT 1
- Make the API host configurable HOT 3
- Very slow requests ? HOT 4
- v0.10.1 release doesn't include a prebuilt dist/ directory HOT 2
- RunesReforged bug HOT 2
- Error: Can't resolve 'fs' in 'D:\Programmierung\my-app\node_modules\dotenv\lib' HOT 9
- TFT Ratelimit (Research)
- trying to use diffrent region the default that was placed in the kayn configuration
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kayn.