[CD] Add try-catch to handle invalid input.

But is that good enough?