FlagValueError

public enum FlagValueError : Error

Error to throw when converting string to FlagValue

  • conversionError: conversation error string This string will be used to be printed to the console

Example

struct User: FlagValue {
  let name: String

  static func fromString(flagValue value: String) throws -> User {
    if value == "wrong" {
        throw FlagValueError.conversionError("wrong user passed")
    }
    return User(name: value)
  }

  static var typeDescription: String {
    return "A user structure"
  }
}
  • Conversation error happened while parsing string to type This string will be used to be printed to the console


    Example

    struct User: FlagValue {
      let name: String
    
      static func fromString(flagValue value: String) throws -> User {
        if value == "wrong" {
            throw FlagValueError.conversionError("wrong user passed")
        }
        return User(name: value)
      }
    
      static var typeDescription: String {
        return "A user structure"
      }
    }
    

    Declaration

    Swift

    case conversionError(String)