Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftcustom error typesSingle-choice MCQ

What is printed by this code that catches a thrown custom error?

struct ValidationError: Error { let field: String } func validate() throws { throw ValidationError(field: "email") } do { try validate() } catch let error as ValidationError { print("field: \(error.field)") } catch { print("other") }