thrift-server
thrift-server copied to clipboard
Add a StructLike class that extends Error.
Description
Exception classes should extend this so that they derive from Error.
Motivation and Context
As mentioned in the thrift-typescript GitHub issue, it's useful for exceptions to derive from Error so they have stack traces and because some frameworks expect it. The GitHub issue mentions graphql-js. Jest's toThrow()
function would also benefit from this. See the related thrift-typescript PR for more details.
How Has This Been Tested?
Tested locally.
Possible remaining work:
- Add a test?
- Bump version number so end users can require the new version.
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the CONTRIBUTING document.
- [ ] I have added tests to cover my changes.
- [x] All new and existing tests passed.
I can clean this up a little (fix tests, update documentation as needed, read the CONTRIBUTING document), but wanted to get feedback from Credit Karma folks to make sure I'm heading in the right direction before spending more time on it.