HandlerFactory : corrected imports and added exception