Throw all errors in the process/fromFiles action
Sentry Issue: ARKINDEX-FRONTEND-ATT
TypeError: undefined has no properties
at start (./src/views/Imports/ImportFromFiles.vue:151:42)
at fn (./src/views/Imports/ImportFromFiles.vue:24:45)
...
(2 additional frame(s) were not displayed)
This TypeError occurred because ImportFromFiles
, the only component that uses the process/fromFiles
action, expected this action to always return an object (a process) with an ID, and to otherwise notify then throw for errors of any kind. The process/fromFiles
action did notify on all errors, but only threw on HTTP 400; on other errors, it did not return anything, so undefined
, which cannot be unpacked into { id }
, causing this TypeError.
The simplest fix here is to have fromFiles
re-throw everything.
As an aside, I had a look at whether or not TypeScript would have fixed this issue: it turns out it cannot fix this issue because of how Vuex itself is structured. There is some pretty extensive discussion of this here, and it appears that typing Vuex would now be possible starting with TypeScript 4.1.0, but the proposal is not getting much feedback from the maintainers and would cause significant backwards compatibility issues. Pinia, aka "Vuex 5", has much better TypeScript support that would have caught this error., but migrating to Pinia would be a whole summer project in itself, especially rewriting the hundreds of related unit tests.