Open dabdemon opened 4 years ago
@dabdemon Thanks for reporting and sorry for the delay! As you described this already pretty well, could you please create a PR for this?
@dabdemon Thank you for bringing up this topic and your PR #264!
I now see your point and agree with you that MetadataFile.prototype.getComponent()
can return null and in this case Manifest.prototype.add()
currently fails trying to access the type
and fullName
property of the component.
That's not good and I think we should act on MetadataFile.prototype.getComponent()
if it returns null.
I can think of two ways to solve this, maybe there are more:
MetadataFile.prototype.getComponent()
MetadataFile.prototype.getComponent()
Then, we can check for null or catch the error and decide whether to exit with an error or print a warning like skipped src/foo/bar.baz of unknown metadata type
depending on the situation.
I don't want to hide cases like that even more by silently ignoring Manifest.prototype.add(null)
What do you think?
When a metadata is not supported, the getComponent() method returns null, but the code keeps running. While evaluating the component.type and component.name in the manifest.prototype.add method, an error is throw and the process fails.
To fix this we need to handle nulls appropriately, since new metadata may be supported yet.