mirror of
https://github.com/mii443/qemu.git
synced 2025-12-03 02:58:29 +00:00
trace: include filename when printing parser error messages
Improves error messages from:
ValueError: Error on line 72: need more than 1 value to unpack
To
ValueError: Error at /home/berrange/src/virt/qemu/trace-events:72:
need more than 1 value to unpack
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180306154650.24075-1-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
committed by
Stefan Hajnoczi
parent
e42860ae83
commit
86b5aacfb9
@@ -291,13 +291,15 @@ class Event(object):
|
||||
self)
|
||||
|
||||
|
||||
def read_events(fobj):
|
||||
def read_events(fobj, fname):
|
||||
"""Generate the output for the given (format, backends) pair.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
fobj : file
|
||||
Event description file.
|
||||
fname : str
|
||||
Name of event file
|
||||
|
||||
Returns a list of Event objects
|
||||
"""
|
||||
@@ -312,7 +314,7 @@ def read_events(fobj):
|
||||
try:
|
||||
event = Event.build(line)
|
||||
except ValueError as e:
|
||||
arg0 = 'Error on line %d: %s' % (lineno, e.args[0])
|
||||
arg0 = 'Error at %s:%d: %s' % (fname, lineno, e.args[0])
|
||||
e.args = (arg0,) + e.args[1:]
|
||||
raise
|
||||
|
||||
|
||||
Reference in New Issue
Block a user