[swift-evolution] Preconditions aborting process in server scenarios [was: Throws? and throws!]

Howard Lovatt howard.lovatt at gmail.com
Fri Jan 20 15:55:39 CST 2017


In Java there is a hierarchy of errors, the idea is that you catch at different severities. It isn't particularly well implemented in Java with a weird hierarchy and errors strangely classified and poor naming. Despite these glaring shortcoming it does actually work!

In Swift this general concept of user defined error type which have a severity level  could be implemented, it might be:

    protocol ProgramFatalError {} // Not possible to catch - terminates program
    protocol ThreadFatalError {} // Not possible to catch - terminates thread, but calls thread's deinit - deinit has access to the error
    protocol Error {} // As is

-- Howard.


More information about the swift-evolution mailing list