/// <summary>
        /// Creates a new instance of the <see cref="ExceptionDetailObject"/> class from the exception.
        /// </summary>
        /// <param name="exception">The exception to be serialized as an <see cref="ExceptionDetailObject"/></param>
        /// <exception cref="ArgumentNullException">The <paramref name="exception"/> parameter is null</exception>
        public ExceptionDetailObject(Exception exception)
        {
            if (exception == null) throw new ArgumentNullException("exception");
            Type = exception.GetType().ToString();
            Message = exception.Message;
            StackTrace = exception.StackTrace;
#if !WINDOWS_PHONE && !PORTABLE
            HelpLink = exception.HelpLink;
#endif
            if (exception.InnerException != null)
            {
                InnerException = new ExceptionDetailObject(exception.InnerException);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new instance of the <see cref="ExceptionDetailObject"/> class from the exception.
        /// </summary>
        /// <param name="exception">The exception to be serialized as an <see cref="ExceptionDetailObject"/></param>
        /// <exception cref="ArgumentNullException">The <paramref name="exception"/> parameter is null</exception>
        public ExceptionDetailObject(Exception exception)
        {
            if (exception == null)
            {
                throw new ArgumentNullException("exception");
            }
            Type       = exception.GetType().ToString();
            Message    = exception.Message;
            StackTrace = exception.StackTrace;
#if !WINDOWS_PHONE && !PORTABLE
            HelpLink = exception.HelpLink;
#endif
            if (exception.InnerException != null)
            {
                InnerException = new ExceptionDetailObject(exception.InnerException);
            }
        }
        public override void Run()
        {
            try
            {
                Logging.LogInfo("Import job being run on file " + _contentFileName);
                StoreWorker.TransactionLog.LogStartTransaction(this);

                var parser = GetParser(_contentFileName);
                var storeDirectory = StoreWorker.WriteStore.DirectoryPath;
                var importDirectory = Path.Combine(Path.GetDirectoryName(storeDirectory), "import");
                var filePath = Path.Combine(importDirectory, _contentFileName);
                var profiler = Logging.IsProfilingEnabled ? new BrightstarProfiler("Import " + _contentFileName) : null;
                Logging.LogDebug("Import file path calculated as '{0}'", filePath);

                using (_fileStream = GetImportFileStream(filePath))
                {
                    _importTripleSink = new StoreTripleSink(StoreWorker.WriteStore, JobId,
                                                            Configuration.TransactionFlushTripleCount,
                                                            profiler:profiler);
                    parser.Parse(_fileStream, this, _graphUri);
                }
                StoreWorker.WriteStore.Commit(JobId, profiler);
                StoreWorker.InvalidateReadStore();

                Logging.LogInfo("Import job completed successfully for " + _contentFileName);
                if (profiler != null)
                {
                    Logging.LogInfo(profiler.GetLogString());
                }
                StoreWorker.TransactionLog.LogEndSuccessfulTransaction(this);
            }
            catch (RdfParserException parserException)
            {
                ErrorMessage = parserException.Message;
                ExceptionDetail = new ExceptionDetailObject(parserException);
                Logging.LogInfo("Parser error processing import job on file " + _contentFileName + ". " + parserException.Message);
                throw;
            }
            catch (Exception ex)
            {
                ErrorMessage = "Error importing file " + _contentFileName + ". " + ex.Message;
                StoreWorker.TransactionLog.LogEndFailedTransaction(this);
                Logging.LogInfo("Error processing import job on file " + _contentFileName + ". Error Message: " + ex.Message + " Stack trace: " + ex.StackTrace);
                throw;
            }
        }
 public SparqlUpdateException(ExceptionDetailObject innerDetail)
     : base("An error occurred while executing the SPARQL update: " + innerDetail.Message) { }
 private static void ExtractSyntaxError(ExceptionDetailObject exceptionDetail)
 {
     if (exceptionDetail == null) return;
     if (exceptionDetail.Type.Equals("VDS.RDF.Parsing.RdfParseException"))
     {
         throw new RdfParseException(exceptionDetail.Message);
     }
     ExtractSyntaxError(exceptionDetail.InnerException);
 }