You might want to print out the exception in the error message.  I think ```ex.what()``` returns the exception message.