lib/fmt/RuntimeError: new library
Replacing FormatRuntimeError().
This commit is contained in:
@@ -25,8 +25,8 @@
|
||||
#include "config/Block.hxx"
|
||||
#include "Log.hxx"
|
||||
#include "PluginUnavailable.hxx"
|
||||
#include "lib/fmt/RuntimeError.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
@@ -80,8 +80,8 @@ input_stream_global_init(const ConfigData &config, EventLoop &event_loop)
|
||||
plugin->name, e.what());
|
||||
continue;
|
||||
} catch (...) {
|
||||
std::throw_with_nested(FormatRuntimeError("Failed to initialize input plugin '%s'",
|
||||
plugin->name));
|
||||
std::throw_with_nested(FmtRuntimeError("Failed to initialize input plugin '{}'",
|
||||
plugin->name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
|
||||
#include "CdioParanoiaInputPlugin.hxx"
|
||||
#include "lib/cdio/Paranoia.hxx"
|
||||
#include "lib/fmt/RuntimeError.hxx"
|
||||
#include "../InputStream.hxx"
|
||||
#include "../InputPlugin.hxx"
|
||||
#include "util/TruncateString.hxx"
|
||||
#include "util/StringCompare.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/ByteOrder.hxx"
|
||||
#include "util/ScopeExit.hxx"
|
||||
@@ -114,8 +114,8 @@ input_cdio_init(EventLoop &, const ConfigBlock &block)
|
||||
else if (strcmp(value, "big_endian") == 0)
|
||||
default_reverse_endian = IsLittleEndian();
|
||||
else
|
||||
throw FormatRuntimeError("Unrecognized 'default_byte_order' setting: %s",
|
||||
value);
|
||||
throw FmtRuntimeError("Unrecognized 'default_byte_order' setting: {}",
|
||||
value);
|
||||
}
|
||||
speed = block.GetBlockValue("speed",0U);
|
||||
|
||||
@@ -263,8 +263,8 @@ input_cdio_open(const char *uri,
|
||||
default:
|
||||
cdio_cddap_close_no_free_cdio(drv);
|
||||
cdio_destroy(cdio);
|
||||
throw FormatRuntimeError("Drive returns unknown data type %d",
|
||||
be);
|
||||
throw FmtRuntimeError("Drive returns unknown data type {}",
|
||||
be);
|
||||
}
|
||||
|
||||
lsn_t lsn_from, lsn_to;
|
||||
@@ -287,8 +287,8 @@ CdioParanoiaInputStream::Seek(std::unique_lock<Mutex> &,
|
||||
offset_type new_offset)
|
||||
{
|
||||
if (new_offset > size)
|
||||
throw FormatRuntimeError("Invalid offset to seek %ld (%ld)",
|
||||
(long int)new_offset, (long int)size);
|
||||
throw FmtRuntimeError("Invalid offset to seek {} ({})",
|
||||
new_offset, size);
|
||||
|
||||
/* simple case */
|
||||
if (new_offset == offset)
|
||||
|
||||
@@ -21,11 +21,10 @@
|
||||
#include "../InputStream.hxx"
|
||||
#include "fs/Path.hxx"
|
||||
#include "fs/FileInfo.hxx"
|
||||
#include "lib/fmt/PathFormatter.hxx"
|
||||
#include "lib/fmt/RuntimeError.hxx"
|
||||
#include "io/FileReader.hxx"
|
||||
#include "io/FileDescriptor.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
|
||||
#include <cinttypes> // for PRIu64 (PRIoffset)
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
@@ -63,8 +62,7 @@ OpenFileInputStream(Path path, Mutex &mutex)
|
||||
const FileInfo info = reader.GetFileInfo();
|
||||
|
||||
if (!info.IsRegular())
|
||||
throw FormatRuntimeError("Not a regular file: %s",
|
||||
path.c_str());
|
||||
throw FmtRuntimeError("Not a regular file: {}", path);
|
||||
|
||||
#ifdef POSIX_FADV_SEQUENTIAL
|
||||
posix_fadvise(reader.GetFD().Get(), (off_t)0, info.GetSize(),
|
||||
@@ -100,9 +98,9 @@ FileInputStream::Read(std::unique_lock<Mutex> &,
|
||||
}
|
||||
|
||||
if (nbytes == 0 && !IsEOF())
|
||||
throw FormatRuntimeError("Unexpected end of file %s"
|
||||
" at %" PRIoffset " of %" PRIoffset,
|
||||
GetURI(), GetOffset(), GetSize());
|
||||
throw FmtRuntimeError("Unexpected end of file {}"
|
||||
" at {} of {}",
|
||||
GetURI(), GetOffset(), GetSize());
|
||||
|
||||
offset += nbytes;
|
||||
return nbytes;
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
|
||||
#include "QobuzErrorParser.hxx"
|
||||
#include "lib/yajl/Callbacks.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
|
||||
#include "lib/fmt/RuntimeError.hxx"
|
||||
|
||||
using std::string_view_literals::operator""sv;
|
||||
|
||||
@@ -46,7 +45,7 @@ QobuzErrorParser::QobuzErrorParser(unsigned _status,
|
||||
{
|
||||
auto i = headers.find("content-type");
|
||||
if (i == headers.end() || i->second.find("/json") == i->second.npos)
|
||||
throw FormatRuntimeError("Status %u from Qobuz", status);
|
||||
throw FmtRuntimeError("Status {} from Qobuz", status);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -55,10 +54,9 @@ QobuzErrorParser::OnEnd()
|
||||
YajlResponseParser::OnEnd();
|
||||
|
||||
if (!message.empty())
|
||||
throw FormatRuntimeError("Error from Qobuz: %s",
|
||||
message.c_str());
|
||||
throw FmtRuntimeError("Error from Qobuz: {}", message);
|
||||
else
|
||||
throw FormatRuntimeError("Status %u from Qobuz", status);
|
||||
throw FmtRuntimeError("Status {} from Qobuz", status);
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
#include "../AsyncInputStream.hxx"
|
||||
#include "event/Call.hxx"
|
||||
#include "event/Loop.hxx"
|
||||
#include "lib/fmt/RuntimeError.hxx"
|
||||
#include "lib/fmt/SystemError.hxx"
|
||||
#include "io/Open.hxx"
|
||||
#include "io/UniqueFileDescriptor.hxx"
|
||||
#include "io/uring/ReadOperation.hxx"
|
||||
#include "io/uring/Queue.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
@@ -191,7 +191,7 @@ OpenUringInputStream(const char *path, Mutex &mutex)
|
||||
throw FmtErrno("Failed to access {}", path);
|
||||
|
||||
if (!S_ISREG(st.st_mode))
|
||||
throw FormatRuntimeError("Not a regular file: %s", path);
|
||||
throw FmtRuntimeError("Not a regular file: {}", path);
|
||||
|
||||
return std::make_unique<UringInputStream>(*uring_input_event_loop,
|
||||
*uring_input_queue,
|
||||
|
||||
Reference in New Issue
Block a user