Own the bug
Bugs slipping into code is inevitable, no matter how carefully we code and test. I have created many bugs in my day, and still make the odd mistake to this day. It is how you respond to your bugs that matter.
If you know there is a bug in your code, own up & fix it. If there is a chance that it has gotten out to live sites then patch & release a fix. If something on the customer side got affected by the bug then make the customer aware and sort it out. Not disclosing creates an atmosphere of mistrust, as the customer is bound to find out eventually.
If you work as part of a team, there is no debate here. Make sure your team knows what is going on. They cannot have your back if they are in the dark.
Making a mistake is human, it is how we learn. Owning our mistakes makes us better coders, it builds character and it often becomes a teachable moment. Telling the customer and fixing their issues makes us a partner they can rely on to give it to them straight, and to be there whenever they encounter any issue, whatever the cause.
I have built and bought many pieces of code in my day, and have been on both sides of this fence many times. Without a doubt, facing your bugs & their impact head on is the only way to go. Anything else and you are in the wrong profession.
I see coding as a public service, as you never know who is going to be using your code. Respect the code.