Well considering you're a prisoner so you did something wrong. What are they honestly going to do? "Are you a rebel?" and you're all "Nah" and they go "Alright off you go" You were caught with Ulfric Stormcloak as if they're going to believe a word you bloody say, it's like being caught in a cave with members of al qaeda and being all "Oh yeah I'm not with them, we're just sharing the same cave because it's more cost effective"
In times of war, innocents are sometimes killed, but if you play through the Imperial beginning you Get Hadvar saying "Stormcloaks, maybe we can reason with them" Yeah one person said you should die, if you judge an entire population because of a single person then that isn't right. Besides the General didn't even realise it, he was busy looking at Ulfric, he probably assumed you were on the list because he has people lower in rank to handle those matters. You get bad people on both sides, but I would of done what she did in all honesty, you were in the wrong place at the wrong time, crap happens.
People always use that "The Empire tried to cut off my head" a Captain tried to have you killed and it is a big deal, almost everything in Skyrim tries to kill you.