First of all, you should identify the mistake that you have committed while performing your task. Discuss it with your manager or boss immediately so that it could be fixed as soon as possible.
Now pay attention to sequence or steps of the task that became a reason to this error. Try to evaluate your mistake and also focus on the ways that could have avoided this error.
Then you should discuss all of your ideas and possibilities with your boss or manager and try to find out effective ways to recover from the error.
The most important thing is to take responsibility of your error by accepting it and make sure that you do not repeat the same mistake in future.
Become more professional and request your manager for attending training workshops, seminars and other programs of professional development which will enable you to avoid any further errors at work.
Try to stick around your manager or boss and ask for his feedback regarding your performance periodically.