This code feels like we don't really know what e is and try to guess attribute names.
nsIObject is called nsISupports, the mother of all interfaces.
A more correct way to check if thats an xpcom object is to do that `if (e instanceof Ci.nsISupports)`

But devil is in the detail. Here you are using fileName and lineNumber,
but I'm not sure any interface has these two attributes.
nsIScriptError has lineNumber but no fileName
http://mxr.mozilla.org/mozilla-central/source/js/xpconnect/idl/nsIScriptError.idl
and nsIException also has lineNumber but no fileName (it has filename)
http://mxr.mozilla.org/mozilla-central/source/xpcom/base/nsIException.idl