Example #1
0
        private static CompilationResult EndCompile(SassContextBase context)
        {
            CompilationResult result;
            SassErrorInfo     error = context.Error;

            if (error == null)
            {
                result = new CompilationResult
                {
                    CompiledContent   = context.OutputString,
                    IncludedFilePaths = context.IncludedFiles.ToList(),
                    SourceMap         = context.SourceMapString
                };
            }
            else
            {
                string message        = error.Message.TrimEnd();
                string sourceCode     = error.Source;
                int    lineNumber     = error.Line;
                int    columnNumber   = error.Column;
                string sourceFragment = SourceCodeNavigator.GetSourceFragment(sourceCode,
                                                                              new SourceCodeNodeCoordinates(lineNumber, columnNumber));

                throw new SassCompilationException(message)
                      {
                          ErrorCode      = error.Status,
                          Description    = error.Text,
                          File           = error.File,
                          LineNumber     = lineNumber,
                          ColumnNumber   = columnNumber,
                          SourceFragment = sourceFragment
                      };
            }

            return(result);
        }
Example #2
0
        private CompilationResult EndCompile(SassContext context)
        {
            FileManagerMarshallingProxy.UnsetFileManager();

            CompilationResult result;

            SassErrorInfo error = context.Error;
            if (error == null)
            {
                result = new CompilationResult
                {
                    CompiledContent = context.OutputString,
                    IncludedFilePaths = context.IncludedFiles.ToList(),
                    SourceMap = context.SourceMapString
                };
            }
            else
            {
                throw new SassСompilationException(error.Message)
                {
                    Status = error.Status,
                    Text = error.Text,
                    File = error.File,
                    LineNumber = error.Line,
                    ColumnNumber = error.Column,
                    Source = error.Source
                };
            }

            return result;
        }