Clean backtrace when possible

@spajus @laurynas @mmozuras 

Related: vinted/core#4633