-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strict run and add document metadata in runtime #1011
Comments
It should already be doing this. It'll try to continue processing files within certain modules that run concurrently if it can, that way you don't have to play whack-a-mole by fixing one file, running, fixing the next error, running, fixing the next error, running, etc. If you can see all the errors from a given module like Razor at once, it's a lot faster to fix things. But then at the end, if any errors/exceptions were logged, it'll exit with a non-zero exit code. I've got lots of CI code that runs Statiq and relies on this behavior, is it not doing that for you?
It actually looks like "strict mode" is a holdover from Wyam code and isn't used in Statiq at all. In general, Statiq should be behaving as if it were in "strict mode" all the time. There is a Bootstrapper.Factory.CreateWeb(args)
.AddSetting(Keys.FailureLogLevel, LogLevel.Warning)
Absolutely - if writing a custom module, there are a series of extensions that can do this. A document is immutable, so you create a new document, passing any additional metadata you want, and the original is cloned with that new metadata. The There's a bunch of ways to write your own module code, from creating a whole module to doing something like this using the await Bootstrapper.Factory
.CreateWeb(args)
.BuildPipeline(
"MyPipeline",
builder => builder.WithProcessModules(
new ReadFiles("*.foo"),
new ExecuteConfig(
Config.FromDocument((ctx, doc) =>
doc.CreateDocument(new MetadataItems
{
{ "Foo", "Bar" }
}))))) You don't even need to go that far though if you just want to add some metadata during the pipeline - the await Bootstrapper.Factory
.CreateWeb(args)
.BuildPipeline(
"MyPipeline",
builder => builder.WithProcessModules(
new ReadFiles("*.foo"),
new SetMetadata("Foo", Config.FromDocument(doc => "Bar"))) |
Hi @daveaglick,
First of all, thanks for the cool engine for static sites. Playing with it for a while and it looks very promising.
Could you please guide me in the following questions:
and according to the documentation I expected that Statiq will throw an exception in runtime or at least stop/exit when some error occurred but it didn't. By the error, I mean smth like an invalid LESS file content (thrown by dotless), etc. but Statiq just logged the error in the control when started and that's all.
Q: How to terminate Statiq with a not-0 exit error code when something has failed on start?
Thanks.
The text was updated successfully, but these errors were encountered: