Two things:

1. If `console` is undefined, this code will throw an error. You can avoid that by checking `if (window.console && console.error)`
2. This is not a good place to be checking if `console.error` exists. There *should* be some code on the page that checks if `console` is defined as one of the first things that happens in the Javascript, and if it isn't, it should define it as a no-op function. I don't know if this is the case, but it *should* be.