Aller au contenu

Log And Rethrow (ARCH9166)

Ce contenu n’est pas encore disponible dans votre langue.

Key swift.logging.log-and-rethrow · Severity warning · Category logging

Flags catch blocks that log the error and then throw it again.

catch { logger.error("\(error)"); throw error }
catch { throw UploadError.failed(underlying: error) }

Either log or rethrow; wrap with context if the caller needs it.