Ideally, in case of else, it should throw an exception.

We have a tests where we need to pass the just key name without actual gpg-key contents. And In that test, I'm checking the error raised by UI saying that 
"Validation failed: Content can't be blank"

If I raise an exception in else part, I think I need to catch that too.. along with UI error.  So I skipped that part. But I'm happy to add and  catch that exception within test. I'll try this and if needed will ping you. thanks