Skip to content

Commit

Permalink
io, net, evnet: quote file names in error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Apr 10, 2024
1 parent b3a31b6 commit 1e4bf90
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/event/InotifyEvent.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ InotifyEvent::AddWatch(const char *pathname, uint32_t mask)
{
int wd = TryAddWatch(pathname, mask);
if (wd < 0)
throw FmtErrno("inotify_add_watch('{}') failed", pathname);
throw FmtErrno("inotify_add_watch({:?}) failed", pathname);

return wd;
}
Expand Down
16 changes: 8 additions & 8 deletions src/io/Open.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ OpenReadOnly(const char *path, int flags)
{
UniqueFileDescriptor fd;
if (!fd.Open(path, O_RDONLY|flags))
throw FmtErrno("Failed to open '{}'", path);
throw FmtErrno("Failed to open {:?}", path);

return fd;
}
Expand All @@ -22,7 +22,7 @@ OpenWriteOnly(const char *path, int flags)
{
UniqueFileDescriptor fd;
if (!fd.Open(path, O_WRONLY|flags))
throw FmtErrno("Failed to open '{}'", path);
throw FmtErrno("Failed to open {:?}", path);

return fd;
}
Expand All @@ -34,7 +34,7 @@ OpenDirectory(const char *path, int flags)
{
UniqueFileDescriptor fd;
if (!fd.Open(path, O_DIRECTORY|O_RDONLY|flags))
throw FmtErrno("Failed to open '{}'", path);
throw FmtErrno("Failed to open {:?}", path);

return fd;
}
Expand All @@ -48,7 +48,7 @@ OpenPath(const char *path, int flags)
{
UniqueFileDescriptor fd;
if (!fd.Open(path, O_PATH|flags))
throw FmtErrno("Failed to open '{}'", path);
throw FmtErrno("Failed to open {:?}", path);

return fd;
}
Expand All @@ -58,7 +58,7 @@ OpenPath(FileDescriptor directory, const char *name, int flags)
{
UniqueFileDescriptor fd;
if (!fd.Open(directory, name, O_PATH|flags))
throw FmtErrno("Failed to open '{}'", name);
throw FmtErrno("Failed to open {:?}", name);

return fd;
}
Expand All @@ -68,7 +68,7 @@ OpenReadOnly(FileDescriptor directory, const char *name, int flags)
{
UniqueFileDescriptor fd;
if (!fd.Open(directory, name, O_RDONLY|flags))
throw FmtErrno("Failed to open '{}'", name);
throw FmtErrno("Failed to open {:?}", name);

return fd;
}
Expand All @@ -78,7 +78,7 @@ OpenWriteOnly(FileDescriptor directory, const char *name, int flags)
{
UniqueFileDescriptor fd;
if (!fd.Open(directory, name, O_WRONLY|flags))
throw FmtErrno("Failed to open '{}'", name);
throw FmtErrno("Failed to open {:?}", name);

return fd;
}
Expand All @@ -88,7 +88,7 @@ OpenDirectory(FileDescriptor directory, const char *name, int flags)
{
UniqueFileDescriptor fd;
if (!fd.Open(directory, name, O_DIRECTORY|O_RDONLY|flags))
throw FmtErrno("Failed to open '{}'", name);
throw FmtErrno("Failed to open {:?}", name);

return fd;
}
Expand Down
2 changes: 1 addition & 1 deletion src/net/Resolver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Resolve(const char *node, const char *service,
#else
const char *msg = gai_strerror(error);
#endif
throw FmtRuntimeError("Failed to resolve '{}':'{}': {}",
throw FmtRuntimeError("Failed to resolve {:?}:{:?}: {}",
node == nullptr ? "" : node,
service == nullptr ? "" : service,
msg);
Expand Down

0 comments on commit 1e4bf90

Please sign in to comment.