Skip to content

Refactor findStripeSubscriptionIdForTeam to return a 404 error instead of undefined when something cannot be found #10892

Closed
@jankeromnes

Description

@jankeromnes

Is your feature request related to a problem? Please describe

Refactor all findStripeSubscriptionIdForTeam to return a 404 error instead of undefined when something cannot be found to be differentiate precisely between various cases.

Describe the behaviour you'd like

E.g.

async findSomething(query): Promise<Something | undefined> {
    if (!something) {
        return undefined;
    }
    return something;
}

would become

async findSomething(query): Promise<Something> {
    if (!something) {
        throw new ResponseError(ErrorCodes.NOT_FOUND, "Could not find something");
    }
    return something;
}

This would of course also need to be handled by all clients, for example the dashboard (where a undefined check should become a 404 error catcher).

Describe alternatives you've considered

  • Staying with undefined (status quo)

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    team: webappIssue belongs to the WebApp teamtype: improvementImproves an existing feature or existing code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions