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

@Raynos

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions