mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-08 22:48:46 +00:00
Add detailed Error component for service widgets
This commit is contained in:
parent
7b7740563e
commit
21017e4716
37 changed files with 113 additions and 113 deletions
|
@ -44,7 +44,7 @@ async function fetchFromPlexAPI(endpoint, widget) {
|
|||
|
||||
if (status !== 200) {
|
||||
logger.error("HTTP %d communicating with Plex. Data: %s", status, data.toString());
|
||||
return [status, data.toString()];
|
||||
return [status, data];
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -65,6 +65,11 @@ export default async function plexProxyHandler(req, res) {
|
|||
logger.debug("Getting streams from Plex API");
|
||||
let streams;
|
||||
let [status, apiData] = await fetchFromPlexAPI("/status/sessions", widget);
|
||||
|
||||
if (status !== 200) {
|
||||
return res.status(status).json({error: {message: "HTTP error communicating with Plex API", data: apiData}});
|
||||
}
|
||||
|
||||
if (apiData && apiData.MediaContainer) {
|
||||
streams = apiData.MediaContainer._attributes.size;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue