mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-13 17:30:22 +01:00
fix: better error handling
This commit is contained in:
@@ -3,10 +3,10 @@ import { AxiosError } from "axios";
|
|||||||
import { getAuthHeaders } from "../jellyfin";
|
import { getAuthHeaders } from "../jellyfin";
|
||||||
|
|
||||||
interface ReportPlaybackProgressParams {
|
interface ReportPlaybackProgressParams {
|
||||||
api: Api | null | undefined;
|
api: Api;
|
||||||
sessionId: string | null | undefined;
|
sessionId: string;
|
||||||
itemId: string | null | undefined;
|
itemId: string;
|
||||||
positionTicks: number | null | undefined;
|
positionTicks: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,10 +21,12 @@ export const reportPlaybackProgress = async ({
|
|||||||
itemId,
|
itemId,
|
||||||
positionTicks,
|
positionTicks,
|
||||||
}: ReportPlaybackProgressParams): Promise<void> => {
|
}: ReportPlaybackProgressParams): Promise<void> => {
|
||||||
if (!api || !sessionId || !itemId || positionTicks == null) {
|
console.info(
|
||||||
throw new Error("Missing required parameters for reportPlaybackProgress");
|
"Reporting playback progress:",
|
||||||
}
|
sessionId,
|
||||||
|
itemId,
|
||||||
|
positionTicks,
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
await api.axiosInstance.post(
|
await api.axiosInstance.post(
|
||||||
`${api.basePath}/Sessions/Playing/Progress`,
|
`${api.basePath}/Sessions/Playing/Progress`,
|
||||||
|
|||||||
Reference in New Issue
Block a user