Skip to content

Commit 4ea3f7d

Browse files
committed
fix(frontend): clarify CivArchive error tooltips
1 parent ce52d95 commit 4ea3f7d

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

‎tests/test_search_source_methods.mjs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { searchSourceMethods } from '../web/resolver/search/search_source_method
55
const {
66
getSearchSourceLabel,
77
getSearchSourceErrorMessage,
8+
getSearchSourceErrorTooltip,
89
getSearchSourceDefinitions,
910
getSearchResultKeysForSources,
1011
getHashLookupSourcesForSearchSources,
@@ -54,7 +55,7 @@ test('search source labels and definitions remain stable', () => {
5455
});
5556

5657
test('CivArchive availability failures receive a user-facing retry message', () => {
57-
const dialog = { getSearchSourceLabel };
58+
const dialog = { getSearchSourceLabel, getSearchSourceErrorMessage };
5859
const temporaryFailure = getSearchSourceErrorMessage.call(
5960
dialog,
6061
'civarchive',
@@ -77,6 +78,10 @@ test('CivArchive availability failures receive a user-facing retry message', ()
7778
getSearchSourceErrorMessage.call(dialog, 'civitai', 'CivAI request timed out'),
7879
'CivAI request timed out'
7980
);
81+
assert.equal(
82+
getSearchSourceErrorTooltip.call(dialog, 'civarchive', 'CivArchive search failed: HTTP 522'),
83+
'CivArchive may be overloaded or temporarily unavailable. Please try again later. Details: CivArchive search failed: HTTP 522'
84+
);
8085
});
8186

8287
test('search source selection maps source ids to result and hash keys', () => {

‎web/resolver/actions/resolve_download_methods.js‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,6 +2486,9 @@ export const resolveDownloadMethods = {
24862486
const sourceErrorMessage = sourceError
24872487
? (this.getSearchSourceErrorMessage?.(source, sourceError) || sourceError)
24882488
: null;
2489+
const sourceErrorTooltip = sourceError
2490+
? (this.getSearchSourceErrorTooltip?.(source, sourceError) || sourceErrorMessage)
2491+
: null;
24892492
if (sourceErrorMessage) sourceErrorMessages.add(sourceErrorMessage);
24902493

24912494
const found = this.hasSearchResults(data);
@@ -2506,7 +2509,7 @@ export const resolveDownloadMethods = {
25062509
status: sourceError ? 'error' : (found ? 'found' : 'none'),
25072510
percent: 100,
25082511
message: sourceErrorMessage || (found ? foundMessage : 'No match'),
2509-
error: sourceError || null
2512+
error: sourceErrorTooltip
25102513
}, missing, { workflowKey });
25112514

25122515
if (data.civitai) {
@@ -2553,6 +2556,8 @@ export const resolveDownloadMethods = {
25532556
const sourceErrorMessage = this.getSearchSourceErrorMessage?.(source, error.message)
25542557
|| error.message
25552558
|| 'Error';
2559+
const sourceErrorTooltip = this.getSearchSourceErrorTooltip?.(source, error.message)
2560+
|| sourceErrorMessage;
25562561
sourceErrorMessages.add(sourceErrorMessage);
25572562
state.lastAttemptSources = Array.from(attemptedSources);
25582563
state.lastAttemptFound = anyFound;
@@ -2562,7 +2567,7 @@ export const resolveDownloadMethods = {
25622567
status: 'error',
25632568
percent: 100,
25642569
message: sourceErrorMessage,
2565-
error: error.message || null
2570+
error: sourceErrorTooltip
25662571
}, missing, { workflowKey });
25672572
this.persistSearchStateForWorkflow(workflowKey, missing, state);
25682573
this.refreshSearchUiForMissing(missing, state, { workflowKey });

‎web/resolver/search/search_source_methods.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ export const searchSourceMethods = {
9292
return message;
9393
},
9494

95+
getSearchSourceErrorTooltip(source, error) {
96+
const technicalMessage = String(error || '').trim();
97+
const displayMessage = this.getSearchSourceErrorMessage(source, technicalMessage);
98+
if (!technicalMessage || technicalMessage === displayMessage) return displayMessage;
99+
return `${displayMessage} Details: ${technicalMessage}`;
100+
},
101+
95102
getSearchSourceDefinitions() {
96103
return [
97104
{

0 commit comments

Comments
 (0)