diff --git a/Sources/Alchemy/SQL/Rune/Relationships/Relationship.swift b/Sources/Alchemy/SQL/Rune/Relationships/Relationship.swift index 5963f1fd..57e4be53 100644 --- a/Sources/Alchemy/SQL/Rune/Relationships/Relationship.swift +++ b/Sources/Alchemy/SQL/Rune/Relationships/Relationship.swift @@ -52,7 +52,7 @@ public protocol RelationshipAllowed { extension Model { public static func from(_ value: Self?) throws -> Self { - try value.unwrap(or: RuneError.relationshipWasNil) + try value.unwrap(or: RuneError.relationshipWasNil(type: Self.self)) } } diff --git a/Sources/Alchemy/SQL/Rune/RuneError.swift b/Sources/Alchemy/SQL/Rune/RuneError.swift index 1bcdea42..af865463 100644 --- a/Sources/Alchemy/SQL/Rune/RuneError.swift +++ b/Sources/Alchemy/SQL/Rune/RuneError.swift @@ -14,7 +14,9 @@ public struct RuneError: Error { public static let notFound = RuneError("Unable to find an element of this type.") /// Couldn't unwrap a relationship that was expected to be nonnil. - public static let relationshipWasNil = RuneError("This non-optional relationship had no matching models.") + public static func relationshipWasNil(type: M.Type) -> RuneError { + RuneError("This non-optional relationship to \(type) has no matching models.") + } /// Couldn't sync a model; its id was nil. public static let syncErrorNoId = RuneError("Can't .sync() an object with a nil `id`.")