Hello,
I would like to output the method name as a string in case of an error.
what I've already done is this: (with thisContext selector asString)
pduDestruct
| result |
result := call ffiPDUDestruct.
result = T_PDU_ERROR PDU_STATUS_NOERROR
ifFalse: [ Error signal:'Method: ' , thisContext selector asString , ' with
result: ', result item asString ]
but now I use it more often. And wanted to rebuild it like that.
initialize
errorBlock := [ :tPduError | Error signal:'Method: ' , thisContext
selector
asString , ' with result: ', tPduError item asString ].
pduDestruct
| result |
result := call ffiPDUDestruct.
result = T_PDU_ERROR PDU_STATUS_NOERROR ifFalse: [ errorBlock value:
result
]
but that doesn't work because "this Context selector toString" now returns
'initialize'.
Can someone give me a hint how to solve this?
Is "thisContext selector asString" the only way to get the name of the
method at runtime?
Thanks in advance.
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html