Skip to content

Commit 8300275

Browse files
committed
Use system_error instead of runtime_error where it fits better
1 parent 35aecff commit 8300275

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/osmium/index/detail/create_map_with_fd.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ DEALINGS IN THE SOFTWARE.
3535

3636
#include <cassert>
3737
#include <cerrno>
38-
#include <cstring>
3938
#include <fcntl.h>
4039
#include <stdexcept>
4140
#include <string>
41+
#include <system_error>
4242
#include <vector>
4343

4444
namespace osmium {
@@ -56,7 +56,7 @@ namespace osmium {
5656
const std::string& filename = config[1];
5757
const int fd = ::open(filename.c_str(), O_CREAT | O_RDWR, 0644); // NOLINT(hicpp-signed-bitwise)
5858
if (fd == -1) {
59-
throw std::runtime_error{std::string{"can't open file '"} + filename + "': " + std::strerror(errno)};
59+
throw std::system_error{errno, std::system_category(), "can't open file '" + filename + "'"};
6060
}
6161
return new T{fd};
6262
}

0 commit comments

Comments
 (0)