Assertions. When I'm writing code, if I spot any edge cases which I think might indicate trouble, I can drop in a line which will let me know in debug builds if such a thing is happening. For bonus points they have no performance effect on release builds so you can check semi-expensive things like eg. assert(someMap.find(someKey) != someMap.end());
Obviously they're not a replacement for checking real error conditions which you have to catch, but they're great for those fringe cases where you think "maybe I should check that" while you're writing the code.