Really fixed bad error handling when transcoding. fixes #75

This commit is contained in:
emeric
2020-08-18 12:49:37 +02:00
parent 06b429da78
commit 09f5ea5b0f
+7 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2020 Emeric Poupon
* *
* This file is part of LMS. * This file is part of LMS.
* *
@@ -59,17 +59,20 @@ Transcoder::start()
if (!std::filesystem::exists(_filePath)) if (!std::filesystem::exists(_filePath))
{ {
LOG(ERROR) << "File '" << _filePath << "' does not exist!"; LOG(ERROR) << "File '" << _filePath << "' does not exist!";
_isComplete = true;
return false; return false;
} }
else if (!std::filesystem::is_regular_file( _filePath) ) else if (!std::filesystem::is_regular_file( _filePath) )
{ {
LOG(ERROR) << "File '" << _filePath << "' is not regular!"; LOG(ERROR) << "File '" << _filePath << "' is not regular!";
_isComplete = true;
return false; return false;
} }
} }
catch (const std::filesystem::filesystem_error& e) catch (const std::filesystem::filesystem_error& e)
{ {
LOG(ERROR) << "File error on '" << _filePath.string() << "': " << e.what(); LOG(ERROR) << "File error on '" << _filePath.string() << "': " << e.what();
_isComplete = true;
return false; return false;
} }
@@ -154,6 +157,7 @@ Transcoder::start()
break; break;
default: default:
_isComplete = true;
return false; return false;
} }
@@ -178,12 +182,14 @@ Transcoder::start()
if (!_child->is_open()) if (!_child->is_open())
{ {
LOG(DEBUG) << "Exec failed!"; LOG(DEBUG) << "Exec failed!";
_isComplete = true;
return false; return false;
} }
if (_child->out().eof()) if (_child->out().eof())
{ {
LOG(DEBUG) << "Early end of file!"; LOG(DEBUG) << "Early end of file!";
_isComplete = true;
return false; return false;
} }