Andrew Schwartzmeyer created MESOS-8861:
-------------------------------------------

             Summary: Clean up error handling
                 Key: MESOS-8861
                 URL: https://issues.apache.org/jira/browse/MESOS-8861
             Project: Mesos
          Issue Type: Task
            Reporter: Andrew Schwartzmeyer
            Assignee: Andrew Schwartzmeyer


First, {{os::strerror}} should be deleted (at least on Windows), and {{errno}} 
should _almost never_ be used, instead preferring {{ErrnoError}}.

Second, {{WindowsError}} and {{WSASocketError}} are redundant. They are 
distinguishable only in that the former calls {{GetLastError}} and the latter 
calls {{WSAGetLastError}}, but these functions are aliases of each other. This 
abstraction also introduced the redundant {{SocketError}}, which is aliased to 
{{ErrnoError}} on Linux and {{WSASocketError}} on Windows. With Windows no 
longer using the CRT, we could conceivably have a {{SystemError}} which is 
correctly {{Errno}} or {{Windows}} depending on the platform.

Third, but this is unlikely to happen, {{Try<T, Error>}} should start returning 
the {{Error}} instead of the string, as we frequently need access to its 
{{code}}, but can't get it because {{Try}} is unfortunately wired to instead 
return the error message string if it's typed on {{Error}}. This is bizarre 
because it will return the {{Error}} class if it's instead {{Try<T, 
ErrnoError>}} etc. If we could also get the {{Error}} back, we could stop 
writing code that checks {{errno}} on POSIX and {{GetLastError()}} on Windows 
manually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to