content-index icon indicating copy to clipboard operation
content-index copied to clipboard

Error handling for delete()

Open Rumyra opened this issue 5 years ago • 2 comments

Currently there is no feedback if the id passed into the delete method doesn't exist in the Content Index.

I'm unsure of what type of exception this should throw, but doing something like:

try {
	registration.index.delete("something");
} catch (e) {
	console.log('Failed to remove content', e.message);
}

would be good programming™️

Rumyra avatar Aug 05 '20 09:08 Rumyra

It might be better to have the promise resolve to true/false depending on whether something was deleted, to match the CacheStorage API.

rayankans avatar Aug 06 '20 13:08 rayankans

Yeh that sounds like a good idea to me.

I do realise good programming™️ would be making sure the id existed within the index before removing it, but I can't help but think having something return would be beneficial.

Rumyra avatar Aug 06 '20 13:08 Rumyra