mirror of
https://github.com/immich-app/immich.git
synced 2025-07-03 21:40:00 +02:00
feat(server)!: search via typesense (#1778)
* build: add typesense to docker * feat(server): typesense search * feat(web): search * fix(web): show api error response message * chore: search tests * chore: regenerate open api * fix: disable typesense on e2e * fix: number properties for open api (dart) * fix: e2e test * fix: change lat/lng from floats to typesense geopoint * dev: Add smartInfo relation to findAssetById to be able to query against it --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
parent
1cc184ed10
commit
0aaeab124d
87 changed files with 3638 additions and 77 deletions
web/src
|
@ -1,5 +1,5 @@
|
|||
import type { Handle, HandleServerError } from '@sveltejs/kit';
|
||||
import { AxiosError } from 'axios';
|
||||
import { AxiosError, AxiosResponse } from 'axios';
|
||||
import { env } from '$env/dynamic/public';
|
||||
import { ImmichApi } from './api/api';
|
||||
|
||||
|
@ -34,11 +34,24 @@ export const handle = (async ({ event, resolve }) => {
|
|||
return res;
|
||||
}) satisfies Handle;
|
||||
|
||||
const DEFAULT_MESSAGE = 'Hmm, not sure about that. Check the logs or open a ticket?';
|
||||
|
||||
export const handleError: HandleServerError = async ({ error }) => {
|
||||
const httpError = error as AxiosError;
|
||||
const response = httpError?.response as AxiosResponse<{
|
||||
message: string;
|
||||
statusCode: number;
|
||||
error: string;
|
||||
}>;
|
||||
|
||||
let code = response?.data?.statusCode || response?.status || httpError.code || '500';
|
||||
if (response) {
|
||||
code += ` - ${response.data?.error || response.statusText}`;
|
||||
}
|
||||
|
||||
return {
|
||||
message: httpError?.message || 'Hmm, not sure about that. Check the logs or open a ticket?',
|
||||
stack: httpError?.stack,
|
||||
code: httpError.code || '500'
|
||||
message: response?.data?.message || httpError?.message || DEFAULT_MESSAGE,
|
||||
code,
|
||||
stack: httpError?.stack
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue