Ensured logging of errors prints the correct info