Add more details to error messages
This commit is contained in:
1 parent
3131f85653
commit
7f7564f66b
4 files changed
+20
-9
No files matched your search
@@ -65,14 +65,23 @@ function OnVideoDetailsTaskResults() as void
|
|||||||
if videoId <> m.top.videoId
|
if videoId <> m.top.videoId
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
if metadata = invalid
|
if not metadata.success
|
||||||
m.busySpinner.visible = false
|
m.busySpinner.visible = false
|
||||||
m.busySpinner.control = "stop"
|
m.busySpinner.control = "stop"
|
||||||
ShowDialog(`Failed to load video information for ${videoId}`, "Video load fail")
|
message = `Failed to load video information for ${videoId}`
|
||||||
|
message += `\nStatus Code: ${metadata.statusCode}`
|
||||||
|
if isstr(metadata.data)
|
||||||
|
message += `\nError: ${metadata.data}`
|
||||||
|
else if isAssocArray(metadata.data)
|
||||||
|
message += `\nError: ${FormatJson(metadata.data)}`
|
||||||
|
end if
|
||||||
|
ShowDialog(message, "Video load fail")
|
||||||
CloseVideo()
|
CloseVideo()
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
metadata = metadata.data
|
||||||
|
|
||||||
contentNode = CreateObject("roSGNode", "ContentNode")
|
contentNode = CreateObject("roSGNode", "ContentNode")
|
||||||
contentNode.addFields({ metadata: metadata })
|
contentNode.addFields({ metadata: metadata })
|
||||||
|
|
||||||
@@ -85,7 +94,6 @@ function OnVideoDetailsTaskResults() as void
|
|||||||
#else
|
#else
|
||||||
contentNode.url = metadata.dashUrl
|
contentNode.url = metadata.dashUrl
|
||||||
#end if
|
#end if
|
||||||
|
|
||||||
else
|
else
|
||||||
stream = metadata.formatStreams[metadata.formatStreams.Count() - 1]
|
stream = metadata.formatStreams[metadata.formatStreams.Count() - 1]
|
||||||
itag = stream.itag
|
itag = stream.itag
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace Http
|
|||||||
return metadata
|
return metadata
|
||||||
end if
|
end if
|
||||||
metadata = Invidious.GetVideoMetadata(videoId)
|
metadata = Invidious.GetVideoMetadata(videoId)
|
||||||
return metadata
|
return metadata.success ? metadata.data : invalid
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function InjectStoryBoard(router as object, dash as string, metadata as object) as string
|
function InjectStoryBoard(router as object, dash as string, metadata as object) as string
|
||||||
|
|||||||
@@ -47,11 +47,11 @@ namespace Invidious
|
|||||||
args = Invidious.DefaultArgs()
|
args = Invidious.DefaultArgs()
|
||||||
response = Requests().get(url, args)
|
response = Requests().get(url, args)
|
||||||
|
|
||||||
' TODO: handle 500 {"error":"This video is unavailable"}
|
return {
|
||||||
if response.statuscode = 200
|
success: response.statuscode = 200,
|
||||||
return response.json
|
statusCode: response.statuscode,
|
||||||
end if
|
data: response.json ?? response.text
|
||||||
return invalid
|
}
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function SearchSuggestions(q as string) as object 'SearchSuggestionResult
|
function SearchSuggestions(q as string) as object 'SearchSuggestionResult
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ function isstr(obj as dynamic) as boolean
|
|||||||
return obj <> invalid and GetInterface(obj, "ifString") <> invalid
|
return obj <> invalid and GetInterface(obj, "ifString") <> invalid
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function isAssocArray(obj as dynamic) as boolean
|
||||||
|
return obj <> invalid and GetInterface(obj, "ifAssociativeArray") <> invalid
|
||||||
|
end function
|
||||||
|
|
||||||
'******************************************************
|
'******************************************************
|
||||||
'isbool
|
'isbool
|
||||||
|
|||||||
Reference in new issue
Block a user