6.5. How to use a backtrace

A backtrace is text that will show you where your program come before the error. This is very useful for developers when they debug. The best is to take an example. Did you try the who module at the end of Section 6.4? If so take it and check it works. Now change the line string command = QUERY(path2who)+" "+QUERY(options2who); to string command = 0;. This will create an error because we put an int into a string. If we want to do that, we have to cast it (for example, use (string) 0). If you have not done it yet, press the More options button in the CIF. and reload the module. Check that the Global Variables -> show_internals option is set to yes, and try your module. You will have an error which should look like this:

This seems awful but it is not. The first line is the error in itself:

where the error occurred. find_file is the name of the function where the error occurred and you have also the arguments given to it. If you use the source, you see mixed find_file(string path, object id). So here path="" and id=object [1]. Next line is the function (low_get_file in configuration.pike) that has called find_file in who.pike. You also have its arguments and so on. This backtrace is very useful when the error doesn't come directly from your code but from another code before.

Notes

[1]

Pike can't display contents of an object but can display any other types.

Copyright © 2010-2024 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout