Browse Source

Unifying error

Pascal Peridont 19 years ago
parent
commit
ebf219faa1
3 changed files with 12 additions and 8 deletions
  1. 9 0
      std/mtwin/mail/Exception.hx
  2. 2 7
      std/mtwin/mail/Imap.hx
  3. 1 1
      std/mtwin/mail/Tools.hx

+ 9 - 0
std/mtwin/mail/Exception.hx

@@ -1,4 +1,13 @@
 package mtwin.mail;
 
 class Exception {
+	ConnectionError(host:String,port:Int);
+	SmtpMailFromError(e:String);
+	SmtpRcptToError(e:String);
+	SmtpDataError(e:String);
+	SmtpSendDataError;
+
+	UnknowResponse(r:String);
+	BadResponse(r:String);
+	ImapFetchError(id:Int);
 }

+ 2 - 7
std/mtwin/mail/Imap.hx

@@ -1,11 +1,6 @@
 package mtwin.mail;
 
-enum ImapException extends mtwin.mail.Exception {
-	UnknowResponse(r:String);
-	ConnectionError(host:String, port:Int);
-	BadResponse(r:String);
-	FetchError(id:Int);
-}
+import mtwin.mail.Exception;
 
 signature ImapConnectionInfo {
 	host: String, 
@@ -221,7 +216,7 @@ class Imap {
 
 		var r = fetchRange( Std.string(id), section, useUid );
 		if( !r.exists(id) ){
-			throw new FetchError(id);
+			throw new ImapFetchError(id);
 		}
 		return r.get(id);
 	}

+ 1 - 1
std/mtwin/mail/Tools.hx

@@ -162,7 +162,7 @@ class Tools {
 			}else if( encoding == "b" ){
 				encoded = decodeBase64(encoded,"\r\n");
 			}else{
-				throw "mtwin.mail.MultiPart.headerDecode: Unknow transfer-encoding: "+encoding;
+				throw "Unknow transfer-encoding: "+encoding;
 			}
 
 			charsetOut = charsetOut.toLowerCase();