eclipse eclipse - 5 months ago 121x
Swift Question

Swift convert NSError to String

Is there a way to convert an error of type NSError in swift to a string?

For example for something like this:

do {
try response.status(.OK).send(fileName: "html/index.html")
} catch {

.send() expects a string by default.


If your error is of type NSError, you can use error.localizedDescription to get the string.