Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 86886 invoked from network); 1 Oct 2009 14:06:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Oct 2009 14:06:44 -0000 Received: (qmail 38402 invoked by uid 500); 1 Oct 2009 14:06:44 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 38375 invoked by uid 500); 1 Oct 2009 14:06:44 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 38366 invoked by uid 99); 1 Oct 2009 14:06:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Oct 2009 14:06:44 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Oct 2009 14:06:41 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 0A71823888C5; Thu, 1 Oct 2009 14:06:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r820663 - /activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/NMSExceptionSupport.cs Date: Thu, 01 Oct 2009 14:06:19 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091001140620.0A71823888C5@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tabish Date: Thu Oct 1 14:06:19 2009 New Revision: 820663 URL: http://svn.apache.org/viewvc?rev=820663&view=rev Log: Adding utility class for Throwing NMS exceptions to make throwing NMS errors easier. Added: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/NMSExceptionSupport.cs (with props) Added: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/NMSExceptionSupport.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/NMSExceptionSupport.cs?rev=820663&view=auto ============================================================================== --- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/NMSExceptionSupport.cs (added) +++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/NMSExceptionSupport.cs Thu Oct 1 14:06:19 2009 @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Apache.NMS +{ + public sealed class NMSExceptionSupport + { + private NMSExceptionSupport() + { + } + + public static NMSException create(string message, string errorCode, Exception cause) + { + NMSException exception = new NMSException(message, errorCode, cause); + return exception; + } + + public static NMSException create(string message, Exception cause) + { + NMSException exception = new NMSException(message, cause); + return exception; + } + + public static NMSException create(Exception cause) + { + if(cause is NMSException) + { + return (NMSException) cause; + } + string msg = cause.Message; + if(msg == null || msg.Length == 0) + { + msg = cause.ToString(); + } + NMSException exception = new NMSException(msg, cause); + return exception; + } + + public static MessageEOFException createMessageEOFException(Exception cause) + { + string msg = cause.Message; + if (msg == null || msg.Length == 0) + { + msg = cause.ToString(); + } + MessageEOFException exception = new MessageEOFException(msg, cause); + return exception; + } + + public static MessageFormatException createMessageFormatException(Exception cause) + { + string msg = cause.Message; + if (msg == null || msg.Length == 0) + { + msg = cause.ToString(); + } + MessageFormatException exception = new MessageFormatException(msg, cause); + return exception; + } + } +} Propchange: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/NMSExceptionSupport.cs ------------------------------------------------------------------------------ svn:eol-style = native