A great article by Soroush Khanlou on how to best create and handle exceptions and errors on your server app. He also shows how to create a Middleware for a Vapor app to add or transform any error in a presentable form in order to respond with to your clients with a meaningful message.
There’s an app in the App Store that lets you keep track of the proposals to the Swift Evolution repository. That app makes use of a backend built with Swift, Kitura, and Docker. The best part is that it’s Open Source!
Last week we saw how to use
enums to improve our APIs. We can apply the same idea to handle our application’s state. Now, when writing a server app, you want to try to be as stateless as possible. However, there will be occasions when you need to perform some long-running operations for which handling some state temporarily is the best approach. Whatever is your situation, if you’re handling state, this is an excellent way to do it!