I went through it.
- Have a plan. Set yourself a time limit for unemployment, after which you can opt to re-train (even part-time, if you need to work immediately). Explore the options and pick the best ones for you.
- build a portfolio, actively work on your interviewing skills, CV, and leetcode ahead of interviews
- schedule time outside and for activity, stop moping and overconsuming social media
Actions determine your identity, not the other way around. If you persevere and adapt, you aren't a failure. If you indulge in self-pity and do nothing, then you are letting that define you.
Anyone who doesn't fail is not being challenged enough. Failure is part of learning and improvement. Notwithstanding that, some factors are out of your hands.