How do you cope without self-harm when your comfort habits hurt you?

So i was taking a course to get a certificate. I could take the test on my phone or laptop, but I only get one chance. I didn't want to accidentally backspace on my phone, so i did it on my laptop. While I was taking the test, my laptop shut down Chrome and went back to the home page
I didn't get to finish the test, and I can't go back in.
I put in a ticket, but this week was the last week to try anyway. Other than that, I have to wait until September to sign up again and then redo all the practice tests and modules. I have a chronic illness, and doing all that stuff took a lot of energy. Im just upset because it's ironic, and I didn't even get a chance to pass or fail.
I have some marshmallow fluff, and I know i shouldn't have it, especially in large amounts, but when im sad, I eat.
Sugary stuff actually makes my chronic illness pain worse
Im probably gonna regret it tomorrow morning, but i feel like the pain in my heart is more important to soothe
How do you cope without self-harm when your comfort habits hurt you?
Post Opinion