diff --git a/frontend/javascripts/messages.tsx b/frontend/javascripts/messages.tsx index 3824118b97a..3f1a549da81 100644 --- a/frontend/javascripts/messages.tsx +++ b/frontend/javascripts/messages.tsx @@ -360,7 +360,6 @@ instead. Only enable this option if you understand its effect. All layers will n "dataset.name.already_taken": "This name is already being used by a different dataset. Please choose a different name.", "dataset.no_data": "No data available! Something seems to be wrong with the dataset.", - "dataset.not_imported": "Please double check if you have the dataset imported:", "dataset.changed_without_reload": "Model.fetch was called for a task with another dataset, without reloading the page.", "dataset.import.required.name": "Please provide a name for the dataset.", diff --git a/frontend/javascripts/viewer/model_initialization.ts b/frontend/javascripts/viewer/model_initialization.ts index e6065ae5c59..277a0834830 100644 --- a/frontend/javascripts/viewer/model_initialization.ts +++ b/frontend/javascripts/viewer/model_initialization.ts @@ -213,6 +213,7 @@ export async function initialize( datasetId, version, ); + assertUsableDataset(apiDataset as StoreDataset, initialCommandType); maybeFixDatasetNameInURL(apiDataset, initialCommandType); const serverVolumeTracings = getServerVolumeTracings(serverTracings); @@ -468,20 +469,30 @@ export function preprocessDataset( return mutableDataset as StoreDataset; } -function initializeDataset(initialFetch: boolean, dataset: StoreDataset): void { +function assertUsableDataset(dataset: StoreDataset, initialCommandType: TraceOrViewCommand) { let error; + let annotationNote = ""; + if (initialCommandType.type === ControlModeEnum.TRACE) { + annotationNote = `Failed to load annotation ${initialCommandType.annotationId}: `; + } if (!dataset) { - error = messages["dataset.does_not_exist"]; + error = `${annotationNote}${messages["dataset.does_not_exist"]}`; } else if (!dataset.dataSource.dataLayers) { - error = `${messages["dataset.not_imported"]} '${dataset.name}'`; + let statusNote = "."; + if (dataset.dataSource.status) { + statusNote = `: ${dataset.dataSource.status}`; + } + error = `${annotationNote}Dataset ‘${dataset.name}’ (${dataset.id}) is not available${statusNote}`; } if (error) { Toast.error(error); throw HANDLED_ERROR; } +} +function initializeDataset(initialFetch: boolean, dataset: StoreDataset): void { // Make sure subsequent fetch calls are always for the same dataset if (!initialFetch) { ErrorHandling.assert( diff --git a/unreleased_changes/8956.md b/unreleased_changes/8956.md new file mode 100644 index 00000000000..77dfaed3dab --- /dev/null +++ b/unreleased_changes/8956.md @@ -0,0 +1,2 @@ +### Changed +- Improved the error message when loading an unusable dataset or an annotation for an unusable dataset