You don't tell where the error occurs or in what context. I'll cover the most common situation. If it don't cover your situation, please ask again and provide us the exact context of the error with as much details as possible.
A script eror appen when a script is badly writen or attempt to do things it's not allowed.
It's usualy a Java script that is at cause.
They mostly pop up when browsing.
As you have no control on the code itself, the solution is to prevent the faulty scripts from starting at all.
It very easy if you use Firefox or Chrome as your browser: Just get the NoScript addon.
It will prevent any script from even starting, while allowing to permit them on a case by case basis (white list) either for a specific script or for a given site or domain. A problem site can be totaly barred.
You can give temporary permissions (for this cession only) or permanent ones. Also, permissions and interdictions can be revoked.
Electro, November 2012