Only throw exceptions that match specification

Change-Id: I3f9c692173fea9496bdda7772a8371e6a5427d3a
String clean-up

Change-Id: I56c397d4cd0ad6c328d660f50189ab5f4b5cfca6