#include <GenericException.h>
Inheritance diagram for Core::GenericException:
Public Member Functions | |
GenericException (String *message=nil, String *selector=nil, Object *param=nil) | |
virtual | ~GenericException (void) |
virtual String * | className (void) const |
Answer receiver class name. | |
virtual String * | description (void) |
virtual String * | notifierString (void) abstract |
virtual const Object * | originator (void) |
virtual void | originator (const Object *object) |
virtual Object * | parameter (void) |
virtual void | selector (String *sel) |
virtual void | selector (const char *sel) |
virtual String * | selector (void) |
virtual void | printStackOn (Stream *stream) |
virtual void | pass (void) |
Passes (propagates) the exception thru the rest of stack. | |
virtual void | raiseFrom (const Object *origin) |
virtual void | raise (void) |
Raises (throws) the receiver as an exception. | |
virtual void | visitBy (Visitor *visitor) |
Static Public Member Functions | |
static GenericException * | lastException (void) |
Protected Member Functions | |
virtual void | getExecutionStack (void) |
virtual void | privRaise (void) abstract |
This method really throws the receiver as an exception. | |
Protected Attributes | |
String * | messageText |
String * | _selector |
const Object * | _originator |
Object * | _parameter |
Static Protected Attributes | |
static GenericException * | last_exception = nil |
Private Attributes | |
void * | method_stack [MAXSTACKSIZE] |
int | stack_size |
It provides some features that may ease debugging.
Definition at line 39 of file GenericException.h.
|
Definition at line 38 of file GenericException.cc. References _originator, _parameter, _selector, messageText, nil, and stack_size. 00040 { 00041 messageText = message; 00042 _selector = selector; 00043 _parameter = param; 00044 _originator = nil; 00045 stack_size = 0; 00046 }
|
|
Definition at line 48 of file GenericException.cc. 00049 { 00050 }
|
|
Answer receiver class name. Because there isn't any standard way to obtain class name this method comes to place. Every class should rewrite this method but many didn't (yet). Reimplemented from Core::Object. Reimplemented in Core::Error, External::ExternalObjectNotFoundError, External::LibraryNotFoundError, Core::FileOpenFailed, Core::IncompleteNextCountError, Core::KeyNotFoundError, Core::NotFoundError, Core::OSError, Core::PositionOutOfBoundsError, Core::SubscriptOutOfBoundsError, Tools::CommandLineMissingArgument, Tools::CommandLineParserError, Tools::CommandLineUnknownArgument, Tools::CommandLineUnsufficientParameters, and Core::ValueNotFoundError. Definition at line 53 of file GenericException.cc. 00054 { 00055 return new String("GenericException"); 00056 }
|
|
Definition at line 64 of file GenericException.cc. References messageText, and notifierString(). 00065 { 00066 if (messageText == NULL) 00067 return notifierString(); 00068 return messageText; 00069 }
|
|
Definition at line 162 of file GenericException.cc. References last_exception, MAXSTACKSIZE, method_stack, and stack_size. Referenced by raise(). 00163 { 00164 // if (last_exception == nil) 00165 // GC_exclude_static_roots(method_stack, method_stack + MAXSTACKSIZE); 00166 last_exception = this; 00167 stack_size = backtrace(method_stack, MAXSTACKSIZE); 00168 }
|
|
Definition at line 58 of file GenericException.cc. References last_exception. 00059 { 00060 return last_exception; 00061 }
|
|
|
Definition at line 77 of file GenericException.cc. References _originator. 00078 { 00079 _originator = object; 00080 }
|
|
Definition at line 71 of file GenericException.cc. References _originator, and nil. Referenced by raiseFrom(). 00072 { 00073 if (_originator == nil) return this; 00074 else return _originator; 00075 }
|
|
Definition at line 82 of file GenericException.cc. References _parameter. 00083 { 00084 return _parameter; 00085 }
|
|
Passes (propagates) the exception thru the rest of stack. In fact it calls privRaise to throw the receiver again. Definition at line 138 of file GenericException.cc. References privRaise(). Referenced by OS::Promise::value(). 00139 { 00140 privRaise(); 00141 }
|
|
Definition at line 103 of file GenericException.cc. References Core::String::copy(), Core::String::demangleMethodName(), Core::String::indexOf(), Core::Stream::lf(), method_stack, Core::String::nextIndexOf(), Core::Stream::nextPutAll(), Core::String::size(), and stack_size. Referenced by Tools::Application::defaultExceptionHandler(). 00104 { 00105 if (method_stack == NULL || stack_size <= 1) { 00106 stream->nextPutAll("No stack."); 00107 return; 00108 } 00109 00110 char **names; 00111 String *line, *module, *mangledName; 00112 int startMark, endMark; 00113 00114 names = backtrace_symbols(method_stack, stack_size); 00115 for (int i = 1; i < stack_size; i++) { 00116 line = new String(names[i]); 00117 startMark = line->indexOf('('); 00118 if (startMark < 0) startMark = line->indexOf(' '); 00119 endMark = line->nextIndexOf('+', startMark, line->size()); 00120 module = dynamic_cast<String *>(line->copy(0, startMark)); 00121 mangledName = dynamic_cast<String *>(line->copy(startMark+1, endMark)); 00122 00123 stream->nextPutAll(" "); 00124 try { 00125 stream->nextPutAll(mangledName->demangleMethodName()); 00126 } 00127 catch (GenericException *ex) { 00128 stream->nextPutAll(mangledName); 00129 } 00130 stream->nextPutAll(" in "); 00131 stream->nextPutAll(module); 00132 stream->lf(); 00133 } 00134 free((void *) names); 00135 }
|
|
This method really throws the receiver as an exception. Every subclass MUST reimplement this method, even if it's parent does. This is because of poor object type handling in C++. :-( Reimplemented in Core::Error, External::ExternalObjectNotFoundError, External::LibraryNotFoundError, Core::FileOpenFailed, Core::IncompleteNextCountError, Core::KeyNotFoundError, Net::NetworkError, Net::UnknownHostError, Core::NotFoundError, Core::OSError, Core::PositionOutOfBoundsError, Core::SubscriptOutOfBoundsError, Tools::CommandLineMissingArgument, Tools::CommandLineParserError, Tools::CommandLineUnknownArgument, Tools::CommandLineUnsufficientParameters, and Core::ValueNotFoundError. |
|
Raises (throws) the receiver as an exception. In fact it calls privRaise to do so. Definition at line 149 of file GenericException.cc. References getExecutionStack(), and privRaise(). Referenced by Core::FileAccessor::FileAccessor(), OS::Environment::getEnv(), and raiseFrom(). 00150 { 00151 getExecutionStack(); 00152 privRaise(); 00153 }
|
|
Definition at line 143 of file GenericException.cc. References originator(), and raise(). Referenced by Net::SocketAccessor::accept(), Core::OrderedCollection::at(), Core::ByteArray::at(), Core::Array::at(), Net::SocketAccessor::bindTo(), Core::ByteArray::checkObject(), Net::SocketAccessor::connectTo(), Core::Object::error(), Net::SocketAccessor::listenFor(), Core::OrderedCollection::put(), Core::ByteArray::put(), Core::Array::put(), Core::ExternalStream::setPosition(), and Net::SocketAccessor::SocketAccessor(). 00144 { 00145 originator(origin); 00146 raise(); 00147 }
|
|
Definition at line 97 of file GenericException.cc. References _selector. 00098 { 00099 return _selector; 00100 }
|
|
Definition at line 92 of file GenericException.cc. References _selector.
|
|
Definition at line 87 of file GenericException.cc. References _selector. 00088 { 00089 _selector = sel; 00090 }
|
|
Reimplemented from Core::Object. Definition at line 156 of file GenericException.cc. References Core::Visitor::visitException(). 00157 { 00158 visitor->visitException(this); 00159 }
|
|
Definition at line 44 of file GenericException.h. Referenced by GenericException(), and originator(). |
|
Definition at line 45 of file GenericException.h. Referenced by GenericException(), and parameter(). |
|
Definition at line 43 of file GenericException.h. Referenced by GenericException(), and selector(). |
|
Definition at line 36 of file GenericException.cc. Referenced by getExecutionStack(), and lastException(). |
|
Definition at line 42 of file GenericException.h. Referenced by description(), GenericException(), and Net::UnknownHostError::UnknownHostError(). |
|
Definition at line 51 of file GenericException.h. Referenced by getExecutionStack(), and printStackOn(). |
|
Definition at line 52 of file GenericException.h. Referenced by GenericException(), getExecutionStack(), and printStackOn(). |