Fix error handling in updateMetadata
async updateMetadata (elementId: UUID, metadata: TypedMetaData) {
try {
if (!this.metadata[elementId]) return
const resp = await api.updateMetadata(metadata)
const elementMetadata = this.metadata[elementId]
const index = elementMetadata.findIndex(md => md.id === resp.id)
if (index < 0) return
elementMetadata.splice(index, 1, resp)
} catch (err) {
useNotificationStore().notify({ type: 'error', text: errorParser(err) })
throw new Error(`Metadata ${metadata.id} not found on element ${elementId}`)
}
},
The error should be thrown @ if (index < 0)