public static crawlerErrorLog CreateAndSave(Exception __axe, IModelRecord __relevantRecord = null, crawlerDomainTask __task = null, crawlerErrorEnum __errorType = crawlerErrorEnum.none) { crawlerErrorLog output = new crawlerErrorLog(__axe, __relevantRecord, __task, __errorType, 1); if (FirstError == null) { FirstError = output; } Console.WriteLine("Error [" + output.Title + "]"); // Console.WriteLine("Message [" + output.Message + "]"); // Console.WriteLine("Spec.msg. [" + output.specificMessage + "]"); string path = output.SaveXML(); Console.WriteLine("Crawler error log saved to: " + path); if (FirstError == output) { if (imbWEMManager.settings.executionLog.doOpenFirstException) { externalToolExtensions.run(externalTool.notepadpp, path); } } if (imbWEMManager.settings.executionLog.doThrowDLCException) { throw __axe; } return(output); }
private void _managedOneTask(object domainTask) { crawlerDomainTask taskToRun = (crawlerDomainTask)domainTask; try { items.running.Add(taskToRun); taskToRun.start(); Thread.Sleep(50); crawlerDomainTask taskToRemove = taskToRun; logger.log("[" + taskToRun.wProfile.domain + "] finished [tl:" + taskToRun.targetLoaded + "][td:" + taskToRun.targetDetected + "]"); items.done.AddUnique(taskToRun); } catch (Exception ex) { crawlerDomainTask taskToRemove = taskToRun; items.done.AddUnique(taskToRun); crawlerErrorLog clog = crawlerErrorLog.CreateAndSave(ex, taskToRun.wRecord, taskToRun, crawlerErrorEnum.domainOneTaskError); aceLog.log("[" + taskToRun.wProfile.domain + "] Thread crashed [" + ex.Message + ":" + ex.GetType().Name); taskToRun.CallAbort(cancelTokens[taskToRun]); } }