#72: Custom Errors with LocalizedError
If your errors need friendly text, conforming to LocalizedError is often enough.
enum LoginError: LocalizedError {
case missingPassword
var errorDescription: String? {
switch self {
case .missingPassword:
return "Please enter a password."
}
}
}
This keeps the error type small while still giving you descriptions suitable for UI and logs.
You can also provide recovery suggestions and failure reasons if you need more context.