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

IonSchemaSystemImpl.loadSchema's execption handling obfuscates cause of exceptions #155

Open
dlurton opened this issue Oct 6, 2020 · 0 comments

Comments

@dlurton
Copy link

dlurton commented Oct 6, 2020

This code here is suboptimal for a number of reasons:

  • If an exception occurs during the loading of any schema, the cause of the exception is lost--instead the cause should be included as the second argument of IonSchemaException so that the stack trace is plainly visible to those who need to troubeshoot. As it is now, the troubleshooter has to go thru a lot of extra hoops to diagnose failed schema loading.
  • This pattern seems to suggest it's ok to throw exceptions when a schema can't be loaded, i.e. during normal operation. I.e. that an Authority should just throw an exception and the Ion schema system will continue searching the other loaded authorities for the schema, however:
    • Throwing exceptions can degrade performance.
    • It is generally never a good idea to throw exceptions during normal program execution--they should only be used for unrecoverable and unexpected errors.

This code really should be refactored to ameliorate these issues.

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

1 participant