scaphold-io / scaphold-issues

Post issues that you find on Scaphold here. Post anything about the platform, docs, boilerplates, etc... Happy Scapholding!
3 stars 0 forks source link

`getX` calls with invalid IDs shouldn't return errors #25

Open brandonmp opened 7 years ago

brandonmp commented 7 years ago

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.