1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
* The contents of this file are subject to the Mozilla Public License Version
6
* 1.1 (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
8
* http://www.mozilla.org/MPL/
10
* Software distributed under the License is distributed on an "AS IS" basis,
11
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
* for the specific language governing rights and limitations under the
15
* The Original Code is mozilla.org code.
17
* The Initial Developer of the Original Code is
18
* Netscape Communications Corporation.
19
* Portions created by the Initial Developer are Copyright (C) 2001
20
* the Initial Developer. All Rights Reserved.
23
* Vidur Apparao (vidur@netscape.com) (Original author)
24
* John Bandhauer (jband@netscape.com)
26
* Alternatively, the contents of this file may be used under the terms of
27
* either the GNU General Public License Version 2 or later (the "GPL"), or
28
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
* in which case the provisions of the GPL or the LGPL are applicable instead
30
* of those above. If you wish to allow use of your version of this file only
31
* under the terms of either the GPL or the LGPL, and not to allow others to
32
* use your version of this file under the terms of the MPL, indicate your
33
* decision by deleting the provisions above and replace them with the notice
34
* and other provisions required by the GPL or the LGPL. If you do not delete
35
* the provisions above, a recipient may use your version of this file under
36
* the terms of any one of the MPL, the GPL or the LGPL.
38
* ***** END LICENSE BLOCK ***** */
40
#include "wspprivate.h"
42
WSPException::WSPException(nsISOAPFault* aFault, nsresult aStatus)
43
: mFault(aFault), mData(nsnull), mStatus(aStatus), mMsg(nsnull)
47
WSPException::WSPException(nsresult aStatus, const char* aMsg,
49
: mFault(nsnull), mData(aData), mStatus(aStatus), mMsg(nsnull)
52
mMsg = (char*) nsMemory::Clone(aMsg, strlen(aMsg)+1);
57
WSPException::~WSPException()
64
NS_IMPL_ISUPPORTS1_CI(WSPException, nsIException)
66
/* readonly attribute string message; */
68
WSPException::GetMessage(char * *aMessage)
70
NS_ENSURE_ARG_POINTER(aMessage);
74
nsAutoString faultString;
75
mFault->GetFaultString(faultString);
76
*aMessage = ToNewUTF8String(faultString);
79
*aMessage = (char*) nsMemory::Clone(mMsg, strlen(mMsg)+1);
86
/* readonly attribute nsresult result; */
88
WSPException::GetResult(nsresult *aResult)
90
NS_ENSURE_ARG_POINTER(aResult);
95
/* readonly attribute string name; */
97
WSPException::GetName(char * *aName)
99
NS_ENSURE_ARG_POINTER(aName);
102
nsAutoString faultCode;
103
mFault->GetFaultCode(faultCode);
104
*aName = ToNewUTF8String(faultCode);
109
/* readonly attribute string filename; */
111
WSPException::GetFilename(char * *aFilename)
113
NS_ENSURE_ARG_POINTER(aFilename);
118
/* readonly attribute PRUint32 lineNumber; */
120
WSPException::GetLineNumber(PRUint32 *aLineNumber)
122
NS_ENSURE_ARG_POINTER(aLineNumber);
127
/* readonly attribute PRUint32 columnNumber; */
129
WSPException::GetColumnNumber(PRUint32 *aColumnNumber)
131
NS_ENSURE_ARG_POINTER(aColumnNumber);
136
/* readonly attribute nsIStackFrame location; */
138
WSPException::GetLocation(nsIStackFrame * *aLocation)
140
NS_ENSURE_ARG_POINTER(aLocation);
145
/* readonly attribute nsIException inner; */
147
WSPException::GetInner(nsIException * *aInner)
149
NS_ENSURE_ARG_POINTER(aInner);
154
/* readonly attribute nsISupports data; */
156
WSPException::GetData(nsISupports * *aData)
158
NS_ENSURE_ARG_POINTER(aData);
169
NS_IF_ADDREF(*aData);
173
/* string toString (); */
175
WSPException::ToString(char **_retval)
178
return GetName(_retval);
181
return GetMessage(_retval);