Whenever things don't go the way we want them to, our vulnerabilities get exposed and our limitations become more active than our strengths resulting in several dysfunctions like low mood, automatic negative thoughts, lack of energy, motivation, concentration, enjoyment, interest etc. Some people experience irritability, become emotionally sensitive with impaired confidence and self esteem. Many a times sleep and appetite gets impaired and some people experience lots of anxiety symptoms, fear or negative ruminations like hopelessness, worthlessness etc. Your description suggests likely depression which is a fairly common condition and treatable
Next Steps
You need to start appreciating your experiences in the context of what I explained above and start understanding how it all manifests. Focus on becoming mindful about them and not letting them affect your functioning and behavior as much as possible. Meet a psychiatrist for comprehensive assessment and appropriate treatment usually using psychological techniques like cognitive behavior therapy, lifestyle modifications, addressing any underlying issues and occasionally some medicines too.