fix QuantumKVCache.callFetchMaybe
This commit is contained in:
parent
29154b99d8
commit
e4c29e7aa0
1 changed files with 5 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ import { MemoryKVCache, type MemoryCacheServices } from '@/misc/cache.js';
|
||||||
import { makeKVPArray, type KVPArray } from '@/misc/kvp-array.js';
|
import { makeKVPArray, type KVPArray } from '@/misc/kvp-array.js';
|
||||||
import { renderInlineError } from '@/misc/render-inline-error.js';
|
import { renderInlineError } from '@/misc/render-inline-error.js';
|
||||||
import { isRetryableSymbol } from '@/misc/is-retryable-error.js';
|
import { isRetryableSymbol } from '@/misc/is-retryable-error.js';
|
||||||
|
import { EntityNotFoundError } from 'typeorm';
|
||||||
|
|
||||||
export interface QuantumKVOpts<T> {
|
export interface QuantumKVOpts<T> {
|
||||||
/**
|
/**
|
||||||
|
|
@ -451,6 +452,10 @@ export class QuantumKVCache<T> implements Iterable<readonly [key: string, value:
|
||||||
const value = await this.fetcher(key, this);
|
const value = await this.fetcher(key, this);
|
||||||
return value ?? undefined;
|
return value ?? undefined;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (err instanceof EntityNotFoundError) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
throw new FetchFailedError(this.name, key, renderInlineError(err), { cause: err });
|
throw new FetchFailedError(this.name, key, renderInlineError(err), { cause: err });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue