It's easy to get the thrift exceptions wrong, given the following thrift:
service Wat {
WatResponse wat(
1: required WatRequest request
)
throws (
1: InvalidRequestException invalid
2: NotFoundException notFound
)
}
I might implement the following endpoint
function wat(context, req, head, body, cb) {
cb(null, {
ok: false,
head: null,
body: { message: 'not found' },
typeName: 'NotFoundException'
});
}
This will confusingly break by returning an empty arg3 body.
What should have happened was an exception like:
assert(true, 'Expected typeName to be one of { invalid, notFound }');
cc @kriskowal @breerly