DDF-169 Implement null checks and fix generic Exception

Also adds tests
Merge pull request #1 from bradh/master

DDF-169 Implement null checks and fix generic Exception
Reviewed by: @mrmateo