Magik programming language
How to capture traceback in magik
Posts  1 - 1  of  1
sourabh
In most cases while doing programming in magik you need to capture traceback's that occur in your code to some external stream(text file) or internal stream(temporary buffer).Below is the sample code for that:-

_protect
_handling error _with
_proc
l_stream << internal_text_input_stream.new()
# dynamic variable holding the current traceback #will write it to internal stream
!traceaback!(l_stream)
_endproc

# line of code that generates traceback because #of wrong file location(just an example)
s << external_text_output_stream.new("c:\test.txt")
_protection
write("traceback has been write to internal stream")
_endprotect

Any suggestion are welcome.
Save
Cancel
Reply
 
x
OK