mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-05 07:28:01 +00:00
657cc22b44
* feat: parse cue * refactor: get delay from backend * feat: add cue to UI * refactor: remove deprecated delay logic * refactor: extract studio clock specific logic * refactor: extract utilities * refactor: fix issue with missing key * style: prevent cue overflow * style: prevent whitespace wrap * feat: add support for cues in integrations
26 lines
737 B
TypeScript
26 lines
737 B
TypeScript
import axios, { AxiosError } from 'axios';
|
|
import { LogLevel } from 'ontime-types';
|
|
import { generateId, millisToString } from 'ontime-utils';
|
|
|
|
import { addLog } from '../stores/logger';
|
|
import { nowInMillis } from '../utils/time';
|
|
|
|
export function logAxiosError(prepend: string, error: unknown) {
|
|
let message;
|
|
if (axios.isAxiosError(error)) {
|
|
const statusText = (error as AxiosError).response?.statusText ?? '';
|
|
const data = (error as AxiosError).response?.data ?? '';
|
|
message = `${prepend} ${statusText}: ${data}`;
|
|
} else {
|
|
message = `${prepend}: ${error}`;
|
|
}
|
|
|
|
addLog({
|
|
id: generateId(),
|
|
origin: 'SERVER',
|
|
time: millisToString(nowInMillis()),
|
|
level: LogLevel.Error,
|
|
text: message,
|
|
});
|
|
}
|