mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-31 20:12:04 +08:00
fix: error details error is handled
This commit is contained in:
parent
53528f1045
commit
6f48030ab9
@ -5,6 +5,7 @@ import Spinner from 'components/Spinner';
|
|||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
import ErrorDetailsContainer from 'container/ErrorDetails';
|
import ErrorDetailsContainer from 'container/ErrorDetails';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useQuery } from 'react-query';
|
import { useQuery } from 'react-query';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { Redirect, useLocation } from 'react-router-dom';
|
import { Redirect, useLocation } from 'react-router-dom';
|
||||||
@ -13,6 +14,7 @@ import { PayloadProps } from 'types/api/errors/getById';
|
|||||||
import { GlobalReducer } from 'types/reducer/globalTime';
|
import { GlobalReducer } from 'types/reducer/globalTime';
|
||||||
|
|
||||||
function ErrorDetails(): JSX.Element {
|
function ErrorDetails(): JSX.Element {
|
||||||
|
const { t } = useTranslation(['common']);
|
||||||
const { maxTime, minTime } = useSelector<AppState, GlobalReducer>(
|
const { maxTime, minTime } = useSelector<AppState, GlobalReducer>(
|
||||||
(state) => state.globalTime,
|
(state) => state.globalTime,
|
||||||
);
|
);
|
||||||
@ -22,6 +24,7 @@ function ErrorDetails(): JSX.Element {
|
|||||||
const errorId = params.get('errorId');
|
const errorId = params.get('errorId');
|
||||||
const errorType = params.get('errorType');
|
const errorType = params.get('errorType');
|
||||||
const serviceName = params.get('serviceName');
|
const serviceName = params.get('serviceName');
|
||||||
|
const defaultError = t('something_went_wrong');
|
||||||
|
|
||||||
const { data, status } = useQuery(
|
const { data, status } = useQuery(
|
||||||
[
|
[
|
||||||
@ -81,7 +84,18 @@ function ErrorDetails(): JSX.Element {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status === 'error' || ErrorIdStatus === 'error') {
|
if (status === 'error' || ErrorIdStatus === 'error') {
|
||||||
return <Typography>{data?.error || errorIdPayload?.error}</Typography>;
|
return (
|
||||||
|
<Typography>
|
||||||
|
{data?.error || errorIdPayload?.error || defaultError}
|
||||||
|
</Typography>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
(status === 'success' && data?.statusCode !== 200) ||
|
||||||
|
(ErrorIdStatus === 'success' && errorIdPayload.statusCode !== 200)
|
||||||
|
) {
|
||||||
|
return <Typography>{data?.error || defaultError}</Typography>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user