diff --git a/esp/src/src-react/components/Menu.tsx b/esp/src/src-react/components/Menu.tsx index 8d9a4f82387..342cad13d63 100644 --- a/esp/src/src-react/components/Menu.tsx +++ b/esp/src/src-react/components/Menu.tsx @@ -298,8 +298,6 @@ export const SubNavigation: React.FunctionComponent = ({ React.useEffect(() => { hasLogAccess().then(response => { setLogsDisabled(!response); - }).catch(() => { - setLogsDisabled(true); }); }, []); const linkStyle = React.useCallback((disabled) => { diff --git a/esp/src/src-react/components/WorkunitDetails.tsx b/esp/src/src-react/components/WorkunitDetails.tsx index f30bbf974ae..ad344dee9f4 100644 --- a/esp/src/src-react/components/WorkunitDetails.tsx +++ b/esp/src/src-react/components/WorkunitDetails.tsx @@ -115,9 +115,6 @@ export const WorkunitDetails: React.FunctionComponent = ({ hasLogAccess().then(response => { setLogsDisabled(!response); return response; - }).catch(err => { - logger.warning(err); - setLogsDisabled(true); }); }, [wuid], [queryParams]); diff --git a/esp/src/src/ESPLog.ts b/esp/src/src/ESPLog.ts index 32a195cff87..5f0c09ed115 100644 --- a/esp/src/src/ESPLog.ts +++ b/esp/src/src/ESPLog.ts @@ -1,4 +1,4 @@ -import { LogaccessService, LogLine, GetLogsExRequest, WsLogaccess } from "@hpcc-js/comms"; +import { LogaccessService, LogLine, GetLogsExRequest, WsLogaccess, Exceptions } from "@hpcc-js/comms"; import { scopedLogger } from "@hpcc-js/util"; import * as Observable from "dojo/store/Observable"; import { Paged } from "./store/Paged"; @@ -8,8 +8,12 @@ const logger = scopedLogger("src/ESPLog.ts"); export const service = new LogaccessService({ baseUrl: "" }); -let g_logAccessInfo: Promise; -export function GetLogAccessInfo(): Promise { +function isExceptionResponse(response: WsLogaccess.GetLogAccessInfoResponse | { Exceptions?: Exceptions }): response is { Exceptions?: Exceptions } { + return (response as { Exceptions?: Exceptions }).Exceptions !== undefined; +} + +let g_logAccessInfo: Promise; +export function GetLogAccessInfo(): Promise { if (!g_logAccessInfo) { g_logAccessInfo = service.GetLogAccessInfo({}); } @@ -41,8 +45,16 @@ export function CreateLogsQueryStore(): LogsQuerySto export function hasLogAccess(): Promise { return GetLogAccessInfo().then(response => { - return response.RemoteLogManagerConnectionString !== null || response.RemoteLogManagerType !== null; + if (isExceptionResponse(response)) { + const err = response.Exceptions.Exception[0].Message; + logger.error(err); + return false; + } else { + response = response as WsLogaccess.GetLogAccessInfoResponse; + return response?.RemoteLogManagerConnectionString !== null || response?.RemoteLogManagerType !== null; + } }).catch(e => { + logger.error(e); return false; }); }