Added checking of empty date. Also added unit tests for exceptions.

Added checking of empty date. Also added unit tests for exceptions.