if (typeof(err) == "string") return err; if (err instanceof Error) return err.message; if (err instanceof Components.interfaces.nsIException) return err.toString(); 
if (err) { if (typeof(err) == "string") return err; if (err instanceof Error) return err.message; if (err instanceof nsIException) return err.toString(); if (isNaN(err)) return ("[" + err + "] unknown error."); } 
function errorToString( err ){    if (typeof(err) == "string")        return err;    if (err instanceof Error)        return err.message;    if (err instanceof Components.interfaces.nsIException)        return err.toString(); // xxx todo: or just message?    // numeric codes:    switch (err) {    case Components.results.NS_ERROR_INVALID_ARG:        return "NS_ERROR_INVALID_ARG";    case Components.results.NS_ERROR_NO_INTERFACE:        return "NS_ERROR_NO_INTERFACE";    case Components.results.NS_ERROR_NOT_IMPLEMENTED:        return "NS_ERROR_NOT_IMPLEMENTED";    case Components.results.NS_ERROR_FAILURE:        return "NS_ERROR_FAILURE";    default:        if (isNaN(err))            return ("[" + err + "] Unknown error.");        // probe for WCAP error:        try {            return wcapErrorToString(err);        }        catch (exc) { // probe for netwerk error:            try {                return netErrorToString(err);            }            catch (exc) {                return ("[0x" + err.toString(16) + "] Unknown error.");            }        }    }}
5872	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5872/a8adf4992620da379274cea3395ed3099b6769d6/calWcapErrors.js/buggy/calendar/providers/wcap/calWcapErrors.js