Software bug is a place in a program where program works in an unexpected way 1. Sometimes called "a feature" because it is a subjective term and it depends on what is defined in user requirements document (there can be a difference between what client/user expected and what is written in this document).
You can call it also "an error" but it's a wrong word for this term. Why? Early error detection is something very useful, especially in complex programs - you immediately know where is the problem. Error should not be avoided or hidden (search for "catch-all" error handling) but rather detected, reported and handled. On the other hand bugs should be avoided at any cost (to avoid them read resources below).
When you avoid even impossible-to-appear bugs or errors than it's called "defensive programming" but in reality it's just following Murphy's Law:
If anything can go wrong, it will
- Software bug - Wikipedia.org
- Defensive programming - Wikipedia.org
- Famous Bugs - John Shore
- Mariner 1 - Wikipedia.org
- How to avoid writing bugs - Chris Wenham
- Y10K and Beyond - S. Glassman, M. Manasse, J. Mogul
when bug is expected than probably code has been written by burned out developer ↩