Skip to content
Snippets Groups Projects
Commit 57f759db authored by Theo Lesage's avatar Theo Lesage Committed by Erwan Rouchet
Browse files

Error handling updatemetadata

parent b718f026
No related branches found
No related tags found
1 merge request!1669Error handling updatemetadata
......@@ -39,11 +39,10 @@ export const useMetaDataStore = defineStore('metadata', {
const resp = await api.updateMetadata(metadata)
const elementMetadata = this.metadata[elementId]
const index = elementMetadata.findIndex(md => md.id === resp.id)
if (index < 0) return
if (index < 0) throw new Error(`Metadata ${metadata.id} not found on element ${elementId}`)
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}`)
}
},
async deleteMetadata (elementId: UUID, metadata: TypedMetaData) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment