1 module hunt.net.Exceptions; 2 3 import hunt.Exceptions; 4 5 import std.exception; 6 import std.conv; 7 8 class SSLException : IOException { 9 mixin basicExceptionCtors; 10 } 11 12 class SSLHandshakeException : SSLException { 13 mixin basicExceptionCtors; 14 } 15 16 class SSLPeerUnverifiedException : SSLException { 17 mixin basicExceptionCtors; 18 } 19 20 class RecoverableProtocolDecoderException : SSLException { 21 mixin basicExceptionCtors; 22 } 23 24 25 /** 26 * An {@link IllegalStateException} which is raised when a user attempts to access a {@link ReferenceCounted} whose 27 * reference count has been decreased to 0 (and consequently freed). 28 */ 29 class IllegalReferenceCountException : IllegalStateException { 30 // mixin basicExceptionCtors; 31 /++ 32 Params: 33 msg = The message for the exception. 34 file = The file where the exception occurred. 35 line = The line number where the exception occurred. 36 next = The previous exception in the chain of exceptions, if any. 37 +/ 38 this(string msg, string file = __FILE__, size_t line = __LINE__, 39 Throwable next = null) @nogc @safe pure nothrow 40 { 41 super(msg, file, line, next); 42 } 43 44 /++ 45 Params: 46 msg = The message for the exception. 47 next = The previous exception in the chain of exceptions. 48 file = The file where the exception occurred. 49 line = The line number where the exception occurred. 50 +/ 51 this(string msg, Throwable next, string file = __FILE__, 52 size_t line = __LINE__) @nogc @safe pure nothrow 53 { 54 super(msg, file, line, next); 55 } 56 57 this(int refCnt) { 58 this("refCnt: " ~ refCnt.to!string()); 59 } 60 61 this(int refCnt, int increment) { 62 this("refCnt: " ~ refCnt.to!string() ~ ", " ~ 63 (increment > 0? "increment: " ~ increment.to!string() : 64 "decrement: -" ~ increment.to!string())); 65 } 66 } 67 68 69 /** 70 * An {@link Exception} which is thrown by a codec. 71 */ 72 class CodecException : RuntimeException { 73 mixin basicExceptionCtors; 74 } 75 76 class DecoderException : CodecException { 77 mixin basicExceptionCtors; 78 } 79 80 class EncoderException : CodecException { 81 mixin basicExceptionCtors; 82 } 83