You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2004/06/13 13:31:18 UTC

cvs commit: ws-axis/c/src/xml AxisParseException.cpp

damitha     2004/06/13 04:31:18

  Added:       c/src/xml AxisParseException.cpp
  Log:
  (null)
  
  Revision  Changes    Path
  1.1                  ws-axis/c/src/xml/AxisParseException.cpp
  
  Index: AxisParseException.cpp
  ===================================================================
  /* -*- C++ -*- */
  /*
   *   Copyright 2003-2004 The Apache Software Foundation.
   *
   *   Licensed 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.
   *
   * 
   * @author  Damitha Kumarage (damitha@opensource.lk, damitha@jkcsworld.com)
   *
   */
  
  #include <axis/AxisParseException.h>
  #include <exception>
  using namespace std;
  
  /**
   *    Default when no parameter passed. When thrown with no parameter
   *    more general SERVER_TRANSPORT_EXCEPTION is assumed.
  */
  AxisParseException::AxisParseException()
  {
      processException(SERVER_TRANSPORT_EXCEPTION);
  }
  
  AxisParseException::AxisParseException (int iExceptionCode)
  {
      m_iExceptionCode = iExceptionCode;
      processException (iExceptionCode);
  }
  
  AxisParseException::AxisParseException (exception* e)
  {
      processException (e);
  }
  
  AxisParseException::AxisParseException (exception* e, int iExceptionCode)
  {
      processException (e, iExceptionCode);
  }
  
  AxisParseException::~AxisParseException() throw ()
  {
  
  }
  
  void AxisParseException::processException (exception* e, int iExceptionCode)
  {
      m_sMessage = getMessage (e) + getMessage (iExceptionCode);
  }
  
  void AxisParseException::processException (exception* e)
  {
      m_sMessage = getMessage (e);
  }
  
  void AxisParseException::processException(int iExceptionCode)
  {
      m_sMessage = getMessage (iExceptionCode);
  }
  
  const string AxisParseException::getMessage (exception* objException)
  {
      m_sMessage = objException->what();
  
      return m_sMessage;
  }
  
  const string AxisParseException::getMessage (int iExceptionCode)
  {
      switch(iExceptionCode)
      {
          case SERVER_PARSE_BUFFER_EMPTY:
              m_sMessage = "Buffer received from the parser is empty";
              break;
          case SERVER_PARSE_PARSER_FAILED:
              m_sMessage = "Parser failed";
              break;
          default:
              m_sMessage = "Unknown Parse Exception"; 
      }
      return m_sMessage;
  }
  
  const char* AxisParseException::what() throw ()
  {
      return m_sMessage.c_str ();
  }
  
  const int AxisParseException::getExceptionCode()
  {
      return m_iExceptionCode;
  }