replaced some assertions with K exceptions

fixed https://github.com/kframework/k/issues/1088

@dwightguth please review