Added Stream::copyTo() and fixed read flag in FileStream::getFeatures().

Made throwOnError() throw Exception instead of std::runtime_error.
This commit is contained in:
Patrick Wuttke
2025-09-22 21:41:31 +02:00
parent 10d9b4c98f
commit 32ccaad00a
2 changed files with 28 additions and 3 deletions

View File

@@ -275,6 +275,8 @@ public:
StreamError getTotalLength(std::size_t& outLength);
StreamError copyTo(Stream& otherStream);
template<template<typename> typename TAllocator>
StreamError readRest(BaseTypelessBuffer<TAllocator>& outBuffer);
@@ -544,7 +546,7 @@ inline void throwOnError(mijin::StreamError error)
if (error == mijin::StreamError::SUCCESS) {
return;
}
throw std::runtime_error(errorName(error));
throw Exception(errorName(error));
}
inline void throwOnError(mijin::StreamError error, std::string message)
@@ -552,7 +554,7 @@ inline void throwOnError(mijin::StreamError error, std::string message)
if (error == mijin::StreamError::SUCCESS) {
return;
}
throw std::runtime_error(message + ": " + errorName(error));
throw Exception(message + ": " + errorName(error));
}
template<typename TSuccess>