Fix use of printStackTrace method

Give the exception to the fail method instead of use printStackTrace exception method.