orThrow

@DeprecatedAsErrorSince(version = KotoolsTypesVersion.V5_1_0)
@ExperimentalSince(version = KotoolsTypesVersion.V4_5_3)
fun orThrow(text: String): EmailAddress

Deprecated (with error)

Use the 'of(String)' function instead.

Replace with

import org.kotools.types.EmailAddress
requireNotNull(EmailAddress of text)

Creates an instance of EmailAddress from the specified text, or throws an IllegalArgumentException if the text doesn't match the default regular expression.

See the orNull function for returning null instead of throwing an exception in case of invalid text.


@DeprecatedAsErrorSince(version = KotoolsTypesVersion.V5_1_0)
@ExperimentalSince(version = KotoolsTypesVersion.V5_0_1)
fun orThrow(text: String, regex: EmailAddressRegex): EmailAddress

Deprecated (with error)

Use the 'of(String, EmailAddressRegex)' function instead.

Replace with

import org.kotools.types.EmailAddress
requireNotNull(EmailAddress.of(text, regex))

Returns an email address from the specified text, or throws an IllegalArgumentException if the text doesn't match the specified regex.

See the orNull function for returning null instead of throwing an exception in case of invalid text.