Z
Zach Dennis
I am having a small dillema. In a program I and a friend are writing I am
proposing to have a Singleton Error/Status object that is updated with
error/status information. For example (this code is nont tested and it is
just a conceptual look):
class StatusSingleton
def setStatus( returnCode , message , obj=nil )
@returnCode = returnCode
@message = message
@obj = obj
end
def getLastReturnCode
return @returnCode
end
def getLastMessage
return @message
end
end
class MyObj
def setTrue
#A Big Error Occurs
StatusSingleton.setStatus( "0x0080" , "Could not set true" );
end
end
m = MyObj.new();
if( !m.setTrue() ) then
MyTkTextFieldWidget.setText( StatusSingleton.getLastMessage() )
end
Is my StatusSinglton overkill? I am trying to consolidate error information
into one class. What do you think?
Thanks,
Zach
proposing to have a Singleton Error/Status object that is updated with
error/status information. For example (this code is nont tested and it is
just a conceptual look):
class StatusSingleton
def setStatus( returnCode , message , obj=nil )
@returnCode = returnCode
@message = message
@obj = obj
end
def getLastReturnCode
return @returnCode
end
def getLastMessage
return @message
end
end
class MyObj
def setTrue
#A Big Error Occurs
StatusSingleton.setStatus( "0x0080" , "Could not set true" );
end
end
m = MyObj.new();
if( !m.setTrue() ) then
MyTkTextFieldWidget.setText( StatusSingleton.getLastMessage() )
end
Is my StatusSinglton overkill? I am trying to consolidate error information
into one class. What do you think?
Thanks,
Zach