Added usage of testing for existence of errors and printing of errors.

Signed-off-by: Jakob Brandsborg Ehmsen <jakobehmsen.github@gmail.com>