summaryrefslogtreecommitdiffstats
path: root/src/Cepis/InvalidCepException.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Cepis/InvalidCepException.cs')
-rw-r--r--src/Cepis/InvalidCepException.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Cepis/InvalidCepException.cs b/src/Cepis/InvalidCepException.cs
new file mode 100644
index 0000000..8257df7
--- /dev/null
+++ b/src/Cepis/InvalidCepException.cs
@@ -0,0 +1,29 @@
+namespace Cepis;
+
+/// <summary>
+/// The CEP is not eight digits.
+/// </summary>
+/// <remarks>
+/// Usually thrown <b>without</b> a request ever being made: the client checks
+/// the format before going to the network, because a seven-digit CEP is the
+/// caller's bug and spending a round trip for the server to say so wastes both
+/// sides' time. It is also thrown when the API answers 400 to a CEP that passed
+/// local validation, in which case it carries the API's own message.
+/// </remarks>
+public sealed class InvalidCepException : CepisException
+{
+ /// <summary>Create the exception with a message.</summary>
+ /// <param name="message">what went wrong</param>
+ public InvalidCepException(string message)
+ : base(message)
+ {
+ }
+
+ /// <summary>Create the exception with a message and an underlying cause.</summary>
+ /// <param name="message">what went wrong</param>
+ /// <param name="innerException">the failure underneath</param>
+ public InvalidCepException(string message, Exception? innerException)
+ : base(message, innerException)
+ {
+ }
+}