Commit 9f4c953b5a492599983919f481cf3a8526132fe7
1 parent
0753e7a8
Exists in
master
and in
1 other branch
Fixing windows errors.
Showing
2 changed files
with
18 additions
and
3 deletions
Show diff stats
client/src/core/windows/request.cc
@@ -152,7 +152,22 @@ | @@ -152,7 +152,22 @@ | ||
152 | // It´s an error, extract message | 152 | // It´s an error, extract message |
153 | in.block[in.used] = 0; | 153 | in.block[in.used] = 0; |
154 | debug("Error was ",rc," (\"",(const char *) (in.block + in.current),"\")"); | 154 | debug("Error was ",rc," (\"",(const char *) (in.block + in.current),"\")"); |
155 | - throw std::system_error(std::error_code(rc,std::system_category()),(const char *) (in.block + in.current)); | 155 | + |
156 | + // Overload system error mostly because of the lack of ENOTCONN message on windows. | ||
157 | + class Error : public std::system_error { | ||
158 | + private: | ||
159 | + std::string message; | ||
160 | + | ||
161 | + public: | ||
162 | + Error(int rc, const char *msg) : std::system_error((int) rc, std::generic_category()), message(msg) { | ||
163 | + } | ||
164 | + | ||
165 | + const char *what() const noexcept override { | ||
166 | + return message.c_str(); | ||
167 | + } | ||
168 | + }; | ||
169 | + | ||
170 | + throw Error(rc, (const char *) (in.block + in.current)); | ||
156 | 171 | ||
157 | } | 172 | } |
158 | 173 |
server/src/core/methods/methods.c
@@ -89,7 +89,7 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req | @@ -89,7 +89,7 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req | ||
89 | if(!g_ascii_strcasecmp(methods[ix].name,method_name)) { | 89 | if(!g_ascii_strcasecmp(methods[ix].name,method_name)) { |
90 | 90 | ||
91 | #ifdef _DEBUG_ | 91 | #ifdef _DEBUG_ |
92 | - g_message("Calling %s",methods[ix].name); | 92 | + lib3270_write_log(hSession,"IPC","Calling %s",methods[ix].name); |
93 | #endif // _DEBUG_ | 93 | #endif // _DEBUG_ |
94 | 94 | ||
95 | int rc = methods[ix].call(object,request,response,error); | 95 | int rc = methods[ix].call(object,request,response,error); |
@@ -99,7 +99,7 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req | @@ -99,7 +99,7 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req | ||
99 | if(rc) | 99 | if(rc) |
100 | { | 100 | { |
101 | debug("%s exits with rc=%d (%s)",methods[ix].name,rc,ipc3270_get_error_message(rc)); | 101 | debug("%s exits with rc=%d (%s)",methods[ix].name,rc,ipc3270_get_error_message(rc)); |
102 | - g_message("%s exits with rc=%d (%s)",methods[ix].name,rc,ipc3270_get_error_message(rc)); | 102 | + lib3270_write_log(hSession,"IPC","%s exits with rc=%d (%s)",methods[ix].name,rc,ipc3270_get_error_message(rc)); |
103 | ipc3270_set_error(object,rc,error); | 103 | ipc3270_set_error(object,rc,error); |
104 | debug("Error Message was set to %s",(*error)->message); | 104 | debug("Error Message was set to %s",(*error)->message); |
105 | } | 105 | } |