A Stoic answers
How would a Stoic handle failure and setbacks?
A Stoic separates the attempt, which is theirs, from the outcome, which is not. You can give your full effort and still fail, because results depend on a thousand things outside your control. So a Stoic does not measure their worth by outcomes at all; they measure it by whether they acted well, honestly and with full effort. A setback is not a verdict but raw material. The obstacle, handled rightly, becomes the next part of the path.
The principleJudge yourself on what is up to you, your effort and your conduct, never on results, which fortune controls. This makes you both relentless and unbreakable.
What the philosophers say

Marcus observed that the mind adapts and turns obstacles to its own use; what stands in the way becomes the way. The impediment to action advances action. What blocks the path becomes the path.

Epictetus would have you aim only at what is yours: the effort, the honesty, the trying. Aim there and you cannot truly fail, because the result was never the target.

Seneca pointed out that no one is hardened without being struck. Difficulty is the only thing that proves what you are made of; fortune favours no one by leaving them untested.
Try this
- Score yourself on effort and conduct, not on the result.
- Ask what this setback makes possible or teaches; treat it as material, not a verdict.
- Take the controllable next step rather than re-living the failure.
- Remember that being tested is the only way character is built; the strike is not the enemy.
Questions
How did Stoics deal with failure?
By judging themselves only on effort and character, which are in their control, rather than on outcomes, which are not. A setback becomes material to work with.
What is the Stoic idea that the obstacle is the way?
It comes from Marcus Aurelius: the mind turns impediments to its own use, so that what blocks the path becomes the path itself.
Ask them yourself
Put your own situation to Marcus, Seneca or Epictetus and hear them answer in their own words.
Talk to a Stoic