I was testing a function that calls getUser(id: 'someId') & writing a test for how it handled a bad ID (eg, id: 'abcd')
When I query an ID that doesn't exist, I get an empty response, which I handle in my function.
However, when the ID doesn't conform to the b64 pattern you use, it instead returns an error.
I think it makes sense for the API to return the same empty response in both cases, as I imagine most use-cases will handle 'record not found' events the same no matter the reason why the record wasn't found.
Having to handle a throw for malformed ids and a regular 'record not found' response is a bit cumbersome.
I was testing a function that calls
getUser(id: 'someId')
& writing a test for how it handled a bad ID (eg,id: 'abcd'
)When I query an ID that doesn't exist, I get an empty response, which I handle in my function.
However, when the ID doesn't conform to the b64 pattern you use, it instead returns an error.
I think it makes sense for the API to return the same empty response in both cases, as I imagine most use-cases will handle 'record not found' events the same no matter the reason why the record wasn't found.
Having to handle a
throw
for malformedids
and a regular 'record not found' response is a bit cumbersome.