Raise exception if endpoint is wrong format