Sex can be messy. Your love life doesn't have to be.
One of the worst things to say when faced with performance problems is, "This has never happened before." While it may be true, it will leave your partner feeling inadequate as a lover. It's also important not to ignore the fact that it happened. Things happen, or don't, in almost every relationship. There is no need to make more out of it than the situation requires. If it's an ongoing issue then getting assistance is a loving thing to do, but don't rush to judgment or you will create the outcome you both fear.
It is entirely natural to feel all kinds of embarrassment, confusion, and disappointment about the situation. Many times, laughter or deflection is the default defense in these very personal moments. Unfortunately, this may lead to a negative interpretation by your partner that, left unaddressed, can damage your relationship. They may not see it as a nervous response, but rather as an unfeeling one at their expense when they are most vulnerable.
The best way to respond to performance issues is gently and with respect. Hopefully, if you find yourself in bed together, you already have good feelings for each other. Focusing on those feelings and not the disappointment you're experiencing can turn the situation into a positive one. Showing love by not overanalyzing the moment is an act of intimacy in itself.
If you can manage your own emotional response maturely, you and your partner can learn and grow from this. Allowing each other to feel safe in this uncertain and distressing moment is heroic, and can help you become the perfect partner you've always wanted to be.