Skip to content
This repository was archived by the owner on May 3, 2022. It is now read-only.
This repository was archived by the owner on May 3, 2022. It is now read-only.

Thrift user experience, add more assertions. #266

Description

@Raynos

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions