Converting assertions to throwing exceptions.

Also re-throwing exceptions after catching them.