Always use our own exception tree

This commit is contained in:
emeric
2018-07-26 10:26:49 +02:00
parent 853bcbe008
commit a31fb3c062
9 changed files with 27 additions and 20 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ static std::string averror_to_string(int error)
}
MediaFileException::MediaFileException(int avError)
: LmsException("MediaFileException: " + averror_to_string(avError))
: AvException("MediaFileException: " + averror_to_string(avError))
{
}
+7 -1
View File
@@ -57,7 +57,13 @@ struct StreamInfo
std::size_t bitrate;
};
class MediaFileException : public LmsException
class AvException : public LmsException
{
public:
AvException(const std::string& msg) : LmsException(msg) {}
};
class MediaFileException : public AvException
{
public:
MediaFileException(int avError);
+4 -4
View File
@@ -52,7 +52,7 @@ std::string encodingToMimetype(Encoding encoding)
return encodingInfo.mimetype;
}
throw std::logic_error("encoding_to_mimetype failed!");
throw AvException("Invalid encoding");
}
int encodingToInt(Encoding encoding)
@@ -63,7 +63,7 @@ int encodingToInt(Encoding encoding)
return encodingInfo.id;
}
throw std::logic_error("encoding_to_int failed!");
throw AvException("Invalid encoding");
}
Encoding encodingFromInt(int encodingId)
@@ -74,7 +74,7 @@ Encoding encodingFromInt(int encodingId)
return encodingInfo.encoding;
}
throw std::logic_error("encoding_from_int failed!");
throw AvException("Invalid encodingId");
}
// TODO, parametrize?
@@ -104,7 +104,7 @@ Transcoder::init()
if (!avConvPath.empty())
LMS_LOG(TRANSCODE, INFO) << "Using transcoder " << avConvPath.string();
else
throw std::runtime_error("Cannot find any transcoder binary!");
throw AvException("Cannot find any transcoder binary!");
}
Transcoder::Transcoder(boost::filesystem::path filePath, TranscodeParameters parameters)