The reason this doesn't work in the same way is because it requires you to know where the error occurs.
You tend to operate on a data structure and know that at some point x becomes y. By placing a watch on x you find out where that point is.
Editing the code does not get you this (bar modern proxies in js).