errorlib: display correct line in stack traces

* get_pretty_traceback would display the line of the end of the scope instead
  of the line the exception appeared in.

Signed-off-by: Alessio Deiana <alessio.deiana@cern.ch>