Question

I am using db8 database and the Foundations JS library to interact with it in a Mojo 2.0 app. When I try to do a find to fetch objects of a kind which is not registered I get an error saying that the kind is not registered.

Two things surprise me, I cannot use a try catch block to catch this error(this part is really surprising). Secondly, if find is not supposed to throw a proper error when a kind is not registered, from the documentation I did not find any other operation that can tell me whether a kind is registered or not. So, is it possible to detect whether a kind is registered or not.

Was it helpful?

Solution

Well, the solution I followed is:

Re-registering a kind leaves the data intact and does not throw any errors. So instead of checking the kinds are registered or not I simply registered them (An unnecessary overhead I agree). I dont know if anyone tried to do this(seems like a pretty simple thing that every app would require.). This is no solution but pretending not to detect whether the kind is registered or not doesnt seem to harm much. Any views on this ?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top