added api exception hierarchy and tests