Okay thank you for this.
So erections are rather complex, and unfortunately it is tricky to control from a psychological perspective. This is because stimulation allows the erection, but you need the psychological processes as well. However if any anxiety, fear comes in to play, it is very easy to lose an erection.
This is where it is very important in avoiding this being an issue, your partner will be worried it is them, and you are worried because you know that is is not.
If you have any pain, discomfort, discharge, urinary symptoms such as going to the toilet more often, then you should attend an urgent treatment centre to get a urine drip to exclude a simple infection. However in the absence of these I would suggest all you will need is lifestyle changes - so if you smoke, stop, do not drink alcohol, do not drink caffeine, drink plenty of water, exercise to raise your heart rate (but cycling unfortunately is not helpful as puts pressure on the nerves involved).
I would avoid any form of masterbation for a few days, give yourself some rest, and then try again in a week.
Explain to your partner that this is not uncommon - but given the short duration of symptoms, I do not believe you have anything to worry about and this will settle. The key thing as mentioned is to avoid getting worried about this, as the anxiety will cause erectile problems (this is all reversible though).
I hope this helps.
Please feel free to ask any further questions.