mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 08:49:02 +08:00
fix: minor error handler message
This commit is contained in:
parent
30b689037a
commit
eb9385840f
@ -10,7 +10,6 @@ import { useGetCompositeQueryParam } from 'hooks/queryBuilder/useGetCompositeQue
|
||||
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
||||
import useDebouncedFn from 'hooks/useDebouncedFunction';
|
||||
import { useEventSourceEvent } from 'hooks/useEventSourceEvent';
|
||||
import { useNotifications } from 'hooks/useNotifications';
|
||||
import { prepareQueryRangePayload } from 'lib/dashboard/prepareQueryRangePayload';
|
||||
import { useEventSource } from 'providers/EventSource';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
@ -38,8 +37,6 @@ function LiveLogsContainer(): JSX.Element {
|
||||
|
||||
const batchedEventsRef = useRef<ILog[]>([]);
|
||||
|
||||
const { notifications } = useNotifications();
|
||||
|
||||
const { selectedTime: globalSelectedTime } = useSelector<
|
||||
AppState,
|
||||
GlobalReducer
|
||||
@ -88,8 +85,8 @@ function LiveLogsContainer(): JSX.Element {
|
||||
);
|
||||
|
||||
const handleError = useCallback(() => {
|
||||
notifications.error({ message: 'Sorry, something went wrong' });
|
||||
}, [notifications]);
|
||||
console.error('Sorry, something went wrong');
|
||||
}, []);
|
||||
|
||||
useEventSourceEvent('message', handleGetLiveLogs);
|
||||
useEventSourceEvent('error', handleError);
|
||||
@ -157,7 +154,6 @@ function LiveLogsContainer(): JSX.Element {
|
||||
|
||||
useEffect((): (() => void) | undefined => {
|
||||
if (isConnectionError && reconnectDueToError && compositeQuery) {
|
||||
console.log('uncaught refetch try from component', reconnectDueToError);
|
||||
// Small delay to prevent immediate reconnection attempts
|
||||
const reconnectTimer = setTimeout(() => {
|
||||
handleStartNewConnection(compositeQuery);
|
||||
|
@ -7,6 +7,7 @@ import { ENVIRONMENT } from 'constants/env';
|
||||
import { LIVE_TAIL_HEARTBEAT_TIMEOUT } from 'constants/liveTail';
|
||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||
import { EventListener, EventSourcePolyfill } from 'event-source-polyfill';
|
||||
import { useNotifications } from 'hooks/useNotifications';
|
||||
import {
|
||||
createContext,
|
||||
PropsWithChildren,
|
||||
@ -58,6 +59,8 @@ export function EventSourceProvider({
|
||||
|
||||
const eventSourceRef = useRef<EventSourcePolyfill | null>(null);
|
||||
|
||||
const { notifications } = useNotifications();
|
||||
|
||||
const handleSetInitialLoading = useCallback((value: boolean) => {
|
||||
setInitialLoading(value);
|
||||
}, []);
|
||||
@ -78,8 +81,6 @@ export function EventSourceProvider({
|
||||
refreshToken: getLocalStorageApi(LOCALSTORAGE.REFRESH_AUTH_TOKEN) || '',
|
||||
});
|
||||
|
||||
console.log('uncaught token refresh started', { response });
|
||||
|
||||
if (response.statusCode === 200) {
|
||||
// Update tokens in local storage
|
||||
afterLogin(
|
||||
@ -96,8 +97,8 @@ export function EventSourceProvider({
|
||||
return;
|
||||
}
|
||||
|
||||
notifications.error({ message: 'Sorry, something went wrong' });
|
||||
// If token refresh failed, logout the user
|
||||
|
||||
if (!eventSourceRef.current) return;
|
||||
eventSourceRef.current.close();
|
||||
setIsConnectionError(true);
|
||||
@ -105,13 +106,14 @@ export function EventSourceProvider({
|
||||
} catch (error) {
|
||||
// If there was an error during token refresh, we'll just
|
||||
// let the component handle the error state
|
||||
notifications.error({ message: 'Sorry, something went wrong' });
|
||||
console.error('Error refreshing token:', error);
|
||||
setIsConnectionError(true);
|
||||
if (!eventSourceRef.current) return;
|
||||
eventSourceRef.current.close();
|
||||
Logout();
|
||||
}
|
||||
}, []);
|
||||
}, [notifications]);
|
||||
|
||||
const destroyEventSourceSession = useCallback(() => {
|
||||
if (!eventSourceRef.current) return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user