CkWebException
What CkWeb throws — only when asked.
Raised by any CkWeb method called with
throwIfInvalid: true when neither the value nor the fallback can be used. Never
thrown otherwise: by default those methods answer "" or false instead. Sealed,
and derived from CkException.
The message names the method, shows the value with its type, says what it was meant to be and why it failed:
CkWeb.Url: cannot use "ftp://x.com" (String) as a web address — not an http or https URL.
Properties
| Property | Type | What it holds |
|---|---|---|
Expected |
string |
What the value was meant to be — "a web address". |
Input |
object? |
From CkException: the value that failed, untouched. |
Reason |
string |
From CkException: why, in a few words. |
Quick look
using SafeCoder.CommonKit;
using SafeCoder.CommonKit.Exceptions;
try
{
CkWeb.Url(
input: "ftp://x.com",
throwIfInvalid: true
);
}
catch (CkWebException error)
{
Console.WriteLine(error.Reason); // -> "not an http or https URL"
Console.WriteLine(error.Expected); // -> "a web address"
}