500 error exception

I'm hoping to clarify whether or not this is expected / ideal behaviour from the API.

If I have a custom type that currently has no published document, I request the API with a UID (i.e. example-uid) and I get the following exception raised. Here's the JSON payload returned.

{
  "message":"[function at(..)] unexpected field 'my.company_profile.uid' on line:1 col:11 in query '[[:d = at(my.company_profile.uid, \"example-uid\")]]'[[:d = at(my.company_profile.uid, \"example-uid\")]]\n ^\n",
  "type":"parsing-error",
  "line":1,
  "column":11,
  "id":0,
  "location":"query"
}

My question is should this be the case? As a consumer, I've got no way of knowing if there are any documents published for that custom type without making a "pre" request to the API for that document type. Which ideally I wouldn't want to do, despite the caching that is afforded by the kit.

If I have a document published and enter a non-existent UID I get no results as expected. I would think that this would be the expected behaviour in this case too.

I maintain the prismic-netstandard kit so I'd love a way to improve this experience for kit comsumers. Are there any examples of this being handle in other kits?

Hi Ben,

Thank you for contributing to the Prismic community,

Can you please share with us the name of the repository you are querying, as well as a code snippet of the query you are passing? You can share that in a private message if necessary?

Looking forward to your reply,
Fares

Hi Ben,

Thanks for your contribution.

I have already created an issue with this to improve error and behavior.

This thread is being monitored as an open ticket in the issue tracker. We will update this post as we get more information. If you have a similar use-case, you can ‘Flag’ this topic to reopen.