I would say take the failure and success out of the equation. That lightens things up a bit. Success and failure will attach to your Ego and you will feel bad or great.
The thing with failure is that it will ultimately “mean” something to you personally. It will let you think you don’t have self worth. If you let it “mean” anything to you it will attach itself to you and now you feel YOU are a failure too.
A way to do it is to think like a scientist. You only are doing experiments. Everything you do, every action you take is an experiment. It has nothing to do with you. The experiment has a goal. Like say make code work and produce a result. It can also be: make 5000 dollars this month. The goal is a 1 or a 0. Binary. Either it is a 1 or a 0. It reaches its goal or not. There is no success or failure here. Only a 1 or 0. No attachment to yourself. No attachment to your SELF.
The experiment will teach you something. Therefore you should be excited to learn from the experiment.
If the experiment is a 0 you analyse it and find out how to improve it to turn it into a 1. You create a new experiment. Based on the lessoms learned from the last experiment.
If it is a 1. You take the next experiment to a next goal.
Thinking in experiments. 1 and 0.
This has worked for me. I take things lightly. More lightly.
Try this experiment. Let me know your thoughts.
And do not make it about YourSELF. It is just about 1s and Os.
Try frame your next action as an experiment like a scientist. Do not attach.