Altinn / altinn-register

Altinn platform microservice for handling register data
0 stars 1 forks source link

PersonLookupService should throw NotFoundException instead of returning null #228

Open CelineTrammi opened 3 weeks ago

CelineTrammi commented 3 weeks ago

Description

The documentation is making it seem as though the client will throw exception if no persons are found, given user input for SSN and last name. However, it returns null if no person is found and maximumFailedAttempts are not at maximum.

I think it is better to be consistent and throw an exception if no person is found rather than using different ways of corrective measures.

try
{
    ...
    return true;
}
catch (PlatformHttpException phex)
{
    switch (phex.Response.StatusCode)
    {
        case HttpStatusCode.TooManyRequests:
            // Add corrective messures
            break;
        case HttpStatusCode.NotFound:
            // Add corrective messures
            break;
    }
    throw;
}

Additional Information

No response