-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
We have logs that contain error messages in various languages like japanese, spanish, french, arabic, etc which causes our bug investigations to be difficult. Having a numerical error code would at least allow us to look up the message online.
Looking at the source, I think the following can be changed in the system_error file in the _System_error class:
Current:
Lines 466 to 473 in 85e4b57
| static string _Makestr(error_code _Errcode, string _Message) { // compose error message | |
| if (!_Message.empty()) { | |
| _Message.append(": "); | |
| } | |
| _Message.append(_Errcode.message()); | |
| return _Message; | |
| } |
Suggested:
static string _Makestr(error_code _Errcode, string _Message) { // compose error message
if (!_Message.empty()) {
_Message.append(": ");
}
_Message.append(to_string(_Errcode.value()));
_Message.append(" - ");
_Message.append(_Errcode.message());
return _Message;
}When calling std::exception::what(), the error code would now be included.
This is just a proposition and I don't really mind the format itself. What's important is just the idea of adding the numerical code.
I wish it was possible to force FormatMessage to output english messages, but it doesn't work if the english package is not installed
Thanks,
Félix