17 questions
0
votes
1
answer
159
views
File search starts with C:\\$Recycle.Bin\\S-1-5-18 and causes filesystem_error
I'm writing a program that searches a file in Windows directory by it's name, starting from C:\. I use recursive_directory_iterator and path from std::filesystem.
The problem is, while user input is ...
1
vote
3
answers
419
views
How can `std::error_category` safely be used in static destructors?
Consider a custom error type written using the LLVM system_category implementation for reference:
#include <iostream>
#include <system_error>
struct my_error_category_type : std::...
0
votes
2
answers
925
views
Is std::error_code a good way to issue warnings? [closed]
I'm currently using std::error_code to give feedback to the users of my API when something goes wrong. Would it be semantically acceptable to add an std::error_condition of type warning to notify my ...
1
vote
0
answers
1k
views
ios_base::failure has no code()
I tried the code from cppreference.com but it seems e.code() is not there:
#include <iostream>
#include <system_error> // std::make_error_condition, std::ios_errc
int main () {
std::cin....
6
votes
3
answers
2k
views
Does std::exception own `what()`?
I'm deriving my own exception, call it MyException, from std::system_error and have overridden what() to calculate and return my message. MyException's initializer list doesn't call the system_error ...
41
votes
3
answers
13k
views
<system_error> categories and standard/system error codes
C++11 introduced the <system_error> header containing a generic system to handle error codes. An std::error_code is a tuple containing an int, the error code, and a reference to an std::...
6
votes
1
answer
2k
views
How do I use `std::error_category` and the other stuff that is in the system_error header?
There are enough error handling strategies in C++ already. We have exception handling, error return codes and this ERRNO mess. What role does the system_error header play here? How do I use the ...
61
votes
1
answer
73k
views
What causes runtime error message: std::system_error - operation not permitted, including mult-threading? [duplicate]
Update in 2022
C++ 17 & 20 now have built in support for multithreading in the standard library. I would suggest using these rather than using the Linux specific pthread library.
Original Question
...
6
votes
2
answers
2k
views
C++11 (or Boost) system_error strategy
I'm working on a system which is designed to use the classes called error_code, error_condition, and error_category -- a scheme newly std: in C++11, altho at the moment I'm actually using the Boost ...