needs_warnings not returning error code or writing to error log
See original GitHub issueUsage of -W
shall handle all warnings as errors and the sphinx-build executable shall return a non-zero value as error code. Also the usage of -w <file>
shall write all warnings to a file.
This works incase of Sphinx warnings, but not for warnings created with needs_warnings
. Because of this pipelines cannot be configured to break incase of needs_warnings
.
To reproduce the problem, do the following steps
- Create
needs_warnings
inconf.py
- Create a need warning within any rST
- Execute sphinx-build as follows from a console
sphinx-build -M html docs _build -W --keep-going -w error.log
- Observe
need_warnings
on the console - Execute the following from the console
echo $?
0
is returned (a non-zero value is expected)- Check the file
error.log
- Only the following line is present
WARNING: Sphinx-Needs warnings were raised. See console / log output for details.
All needs_warnings
are expected in the log.
Could it be that needs_warnings
is always writing to stdout instead of stderror (even with -W)?
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (6 by maintainers)
Top Results From Across the Web
Errors not being written to error.log, inside a custom class
List most recent changed files: I figured that maybe a plugin or some code changes which debug-file to write to. · Boot server:...
Read more >Functions, exceptions, return types and when to log your errors
Functions' purpose is to take your code from A (input) to B (return value, output). If something breaks between A and B, then...
Read more >IIS Error Logs and Other Ways to Find ASP.Net Failed Requests
Instead of being frustrated from unknown ASP.NET errors, learn to troubleshoot errors using IIS error logs.
Read more >USMT return codes - Windows Client - Microsoft Learn
This article describes User State Migration Tool (USMT) 10.0 return codes and error messages. Also included is a table listing the USMT ...
Read more >error_log - Manual - PHP
Returns true on success or false on failure. If message_type is zero, this function always returns true , regardless of whether the error...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@haiyangToAI figured out the reason: The status code calculation happens in Sphinx far too early and is based on a warning_count. See https://github.com/sphinx-doc/sphinx/blob/81a4fd973d4cfcb25d01a7b0be62cdb28f82406d/sphinx/application.py#L345 As our warning-checks happen in the cleanup-phase, which gets executed by Sphinx after the status code calculation, the value for status_code may not be valid anymore.
@haiyangToAI is currently checking if we can make a dirty-hack and change this value on our own.
@haiyangToAI @danwos How can we conclude this topic? My current understanding from the above discussion is that, sphinx-needs warnings (or in general warnings thrown by sphinx extensions?) are treated differently compared to sphinx warnings. Is this an issue coming sphinx or sphinx-needs?