Day 16: Exceptions - String to Integer

  • + 0 comments

    I'm using swift, and getting the same error over and over, did anyone knows how to solve it?

    this is meu received error: Compiler Message Error reading result file.You should use exception handling concepts.

    and this is my working code:

    func stringToInt(inputString: String) throws -> Int {
        guard let value = Int(inputString) else {
            throw StringToIntTypecastingError.BadString
        }
        return value
    }