private void RegisterError(AbstractCallback callback, CallbackEvent evt, AppInfo app, Exception e) { int eSpaceId = 0; int tenantId = 0; HeContext heContext = null; try { eSpaceId = (app != null? app.eSpaceId : 0); tenantId = (app != null && HttpContext.Current != null? app.Tenant.Id : 0); if (app != null) { heContext = app.OsContext; } } catch { } int errors = 0; _errorsInCallbacks.TryGetValue(callback, out errors); _errorsInCallbacks[callback] = (errors + 1); ErrorLog.LogApplicationError( eSpaceId, tenantId, "Error invoking callback " + callback.GetType().FullName + " on event " + evt.ToString() + ": " + e.Message, e, heContext, "Callback"); }