mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-15 19:22:19 +08:00
feat: Improve error handling in DanmakuMergerHandler
Also returns file name of the source of exception in error message.
This commit is contained in:
parent
c428086ccb
commit
c8a63cc71b
|
@ -174,7 +174,22 @@ namespace BililiveRecorder.ToolBox.Tool.DanmakuMerger
|
||||||
for (var i = 0; i < inputLength; i++)
|
for (var i = 0; i < inputLength; i++)
|
||||||
{
|
{
|
||||||
var r = readers[i]!;
|
var r = readers[i]!;
|
||||||
var el = ReadDanmakuElement(r);
|
XElement? el = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
el = ReadDanmakuElement(r);
|
||||||
|
}
|
||||||
|
catch (Exception readEx)
|
||||||
|
{
|
||||||
|
return new CommandResponse<DanmakuMergerResponse>
|
||||||
|
{
|
||||||
|
Status = ResponseStatus.InputIOError,
|
||||||
|
Exception = readEx,
|
||||||
|
ErrorMessage = request.Inputs[i] + ": " + readEx.Message
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (el is null)
|
if (el is null)
|
||||||
{
|
{
|
||||||
readers[i] = null;
|
readers[i] = null;
|
||||||
|
@ -206,7 +221,23 @@ namespace BililiveRecorder.ToolBox.Tool.DanmakuMerger
|
||||||
if (reader is not null)
|
if (reader is not null)
|
||||||
{
|
{
|
||||||
readNextElementFromSameReader:
|
readNextElementFromSameReader:
|
||||||
var newEl = ReadDanmakuElement(reader);
|
|
||||||
|
XElement? newEl = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
newEl = ReadDanmakuElement(reader);
|
||||||
|
}
|
||||||
|
catch (Exception readEx)
|
||||||
|
{
|
||||||
|
return new CommandResponse<DanmakuMergerResponse>
|
||||||
|
{
|
||||||
|
Status = ResponseStatus.InputIOError,
|
||||||
|
Exception = readEx,
|
||||||
|
ErrorMessage = request.Inputs[readerIndex] + ": " + readEx.Message
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (newEl is null)
|
if (newEl is null)
|
||||||
{
|
{
|
||||||
// 文件已结束
|
// 文件已结束
|
||||||
|
|
Loading…
Reference in New Issue
Block a user