You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, if you are using the Local API and you have a typo in your collection slug, the operation will fail because the referenced collection will not be found.
Instead of failing with a non-descriptive error message, we should throw an error that describes what happened more clearly.
This affects only the Local API and the local operations should be the only thing needing to be touched here.
For example, in the findByID local operation (/src/collections/operations/local/findByID.ts):
exportdefaultasyncfunctionfindByIDLocal<TextendsTypeWithID=any>(payload: Payload,options: Options): Promise<T>{// ... the operation code hereconstcollection=payload.collections[collectionSlug];// New code starts hereif(!collection){thrownewAPIError(`The collection with slug ${collectionSlug} can't be found.`);}// End of new code, rest of operation goes here}
We would want to go through and do this for all local operations.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Right now, if you are using the Local API and you have a typo in your collection
slug
, the operation will fail because the referenced collection will not be found.Instead of failing with a non-descriptive error message, we should throw an error that describes what happened more clearly.
This affects only the Local API and the local operations should be the only thing needing to be touched here.
For example, in the
findByID
local operation (/src/collections/operations/local/findByID.ts
):We would want to go through and do this for all local operations.
Beta Was this translation helpful? Give feedback.
All reactions