kyua icon indicating copy to clipboard operation
kyua copied to clipboard

utils::cmdline::print_error should log caller's line number

Open jmmv opened this issue 11 years ago • 1 comments

From asomers on November 06, 2013 23:03:46

utils::cmdline::print_error logs its own line number in the error message. That's not very useful. It would be better to log the line number of the calling function. For example:

20131107-035316 E 6902 utils/cmdline/ui.cpp:240: Load of 'Kyuafile' failed: Failed to load Lua file 'Kyuafile': Kyuafile:24: attempt to call global 'pyunittest_test_program' (a nil value)

It would be more useful if it read:

20131107-035316 E 6902 cli/main.cpp:293: Load of 'Kyuafile' failed: Failed to load Lua file 'Kyuafile': Kyuafile:24: attempt to call global 'pyunittest_test_program' (a nil value)

What version of the product are you using?

On what operating system? kyua-cli 66a06cad12cb704e3060c1675986167cbabe4f4c on Ubuntu 10.04

Original issue: http://code.google.com/p/kyua/issues/detail?id=73

jmmv avatar Feb 22 '14 21:02 jmmv

Showing the line where print_error is called would be useless as well. Pointing to cli/main.cpp provides no additional value.

We should probably show the line where the error originated; i.e. where the "throw" happened, and to do that, we need to instrument throw with a macro so that the throw also logs the error (with the right call site data) or so that the exception classes include the caller site data (harder).

The former is easier and sounds worthwhile...

jmmv avatar Oct 13 '14 19:10 jmmv