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

fix: unhandled exception for index not found in reflected types #45

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yamishav
Copy link

Fix for:
On

const { explicitType, index, object, method } = param;
const type = Reflect.getMetadata('design:paramtypes', object, method)[index];

An error can be thrown if the index is not in the array;

@codecov
Copy link

codecov bot commented Apr 26, 2020

Codecov Report

Merging #45 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #45   +/-   ##
=======================================
  Coverage   99.47%   99.48%           
=======================================
  Files           4        4           
  Lines         191      193    +2     
  Branches       58       59    +1     
=======================================
+ Hits          190      192    +2     
  Misses          1        1           
Impacted Files Coverage Δ
src/generateSpec.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update addba0b...65f04c2. Read the comment docs.

Copy link
Owner

@epiphone epiphone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Can you add a test case to demonstrate the error?

Also please run yarn format so that we get rid of the whitespace changes in the diff.

@yamishav
Copy link
Author

yamishav commented Apr 27, 2020

Hi, I updated the yarn format.
Regarding the test, we are having a complex senior where we auto-generate the endpoints so it's a little complex to reproduce the bug on a test
In this case, the reflection has issues handling the getMetadata and the index is trying to access a out of index in the array

@epiphone
Copy link
Owner

Ok, I'll look into adding a test and getting this merged his week.

@yamishav
Copy link
Author

any updates?

@yamishav
Copy link
Author

Hi, Any chance we can move on with the PR?

@epiphone
Copy link
Owner

Okay, please revert the lock file deletion and we'll get this merged!

@epiphone
Copy link
Owner

The reason I'm a bit hesitant merging this is it's unclear to me whether this is something we should handle in the library or is this an edge case specific to your particular setup and thus better handled in your codebase. Hard to say without knowing the context or having a test!

Then again it should be a pretty non-intrusive change so might as well go for it, I think.

@yamishav
Copy link
Author

ok. I have reverted it

@epiphone
Copy link
Owner

Your previous commit added a bunch of .idea/ files, let's get rid of those eh?

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

Successfully merging this pull request may close these issues.

2 participants