At best, telling your employer you're thinking about leaving is childish, like folks in relationships who "break up" as a means of communicating their displeasure instead of talking about the actual issues. At worst it means the relationship is actually bad and one or both of you can't communicate well, so it's over.
The only time it's acceptable IMO is when you're thinking about leaving for an actual, offered role that's much different, eg, "I'm thinking of leaving to be CTO of Startup X, what do you think?"; in any event it's probably OK if the reasons are beyond the company's control (you're moving, etc).