Skip to content

Commit

Permalink
Handle unknown state nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
arildm committed Oct 3, 2023
1 parent 427f44a commit 83d69d2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/corpus/corpusState.composable.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ export function useCorpusState(corpusId) {
if (korpStatus.value.isDone || strixStatus.value.isDone)
return CorpusState.DONE_INSTALL;

throw RangeError(
console.warn(
`Invalid state, sparv=${sparvStatus.value.state}, korp=${korpStatus.value.state}, strix=${strixStatus.value.state}`
);
return CorpusState.UNKNOWN;
});

const isConfigValid = computed(
Expand Down Expand Up @@ -99,6 +100,9 @@ export function useCorpusState(corpusId) {
}

export class CorpusState {
static get UNKNOWN() {
return "unknown";
}
static get EMPTY() {
return "empty";
}
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ corpus.delete: Delete corpus
corpus.delete.ask: Are you sure you want to delete this corpus?
corpus.deleting: Deleting corpus
corpus.list.loading: Listing corpora
corpus.state.unknown: Unknown
corpus.state.empty: No files
corpus.state.needing_config: Configuration needed
corpus.state.needing_meta: Metadata needed
Expand All @@ -36,6 +37,7 @@ corpus.state.running_install: Installing
corpus.state.done_install: Done installing
corpus.state.failed: Failed
corpus.state.failed_install: Failed
corpus.state.help.unknown: The state of this corpus is unknown. If you need help, please contact sb-info{'@'}svenska.gu.se
corpus.state.help.empty: There are no source texts in this corpus. Upload some text files below.
corpus.state.help.needing_config: This corpus needs you to change some settings before it can be processed.
corpus.state.help.needing_meta: The corpus needs a name before it can be processed.
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/sv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ corpus.delete: Radera korpus
corpus.delete.ask: Är du säker på att du vill ta bort den här korpusen?
corpus.deleting: Raderar korpus
corpus.list.loading: Hämtar korpusar
corpus.state.unknown: Okänt
corpus.state.empty: Inga filer
corpus.state.needing_config: Behöver konfigureras
corpus.state.needing_meta: Behöver metadata
Expand All @@ -37,6 +38,7 @@ corpus.state.running_install: Installerar
corpus.state.done_install: Installation färdig
corpus.state.failed: Fel
corpus.state.failed_install: Fel
corpus.state.help.unknown: Den här korpusen är i ett okänt tillstånd. Om du behöver hjälp kan du kontakta sb-info{'@'}svenska.gu.se
corpus.state.help.empty: Den här korpusen har inga källtexter. Ladda upp textfiler nedan.
corpus.state.help.needing_config: Den här korpusen behöver några inställningar innan annoteringen kan startas.
corpus.state.help.needing_meta: Korpusen behöver ha ett namn innan annoteringen kan startas.
Expand Down

0 comments on commit 83d69d2

Please sign in to comment.