% \iffalse meta-comment
% SPDX-FileCopyrightText: Copyright (c) 2023-2026 Yegor Bugayenko
% SPDX-License-Identifier: MIT
% \fi

% \CheckSum{0}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}

% \GetFileInfo{fail-fast.dtx}
% \DoNotIndex{\endgroup,\begingroup,\let,\else,\fi,\newcommand,\newenvironment}

% \iffalse
%<*driver>
\ProvidesFile{fail-fast.dtx}
%</driver>
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{fail-fast}
%<*package>
[2026-07-13 0.1.0 Turns warnings into errors]
%</package>
%<*driver>
\documentclass{ltxdoc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{microtype}
\AddToHook{env/verbatim/begin}{\microtypesetup{protrusion=false}}
\usepackage{href-ul}
\usepackage[dtx,runs=2]{docshots}
\PageIndex
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
	\DocInput{fail-fast.dtx}
	\PrintChanges
	\PrintIndex
\end{document}
%</driver>
% \fi

% \title{|fail-fast|: \LaTeX{} Package \\ that turns warnings into errors\thanks{The sources are in GitHub at \href{https://github.com/yegor256/fail-fast}{yegor256/fail-fast}}}
% \author{Yegor Bugayenko \\ \texttt{yegor256@gmail.com}}
% \date{\filedate, \fileversion}
%
% \maketitle
%
% \section{Introduction}
%
% Once included, this package promotes \LaTeX{} warnings to errors, thereby rendering the build
% more fragile by design. Such strictness constitutes a desirable practice whenever document
% quality is to be preserved with rigour and protected from regressions introduced by subsequent
% modifications:
% \begin{docshot}
% \documentclass{article}
% \usepackage{fail-fast}
% \pagestyle{empty}
% \begin{document}
% The document content goes here.
% \end{document}
% \end{docshot}

% The development of this package was motivated by a
% \href{https://stackoverflow.com/questions/3244908}{Stack Overflow question}.

% \StopEventually{}

% \section{Implementation}
% \changes{v0.0.1}{2023/07/01}{Initial version, which turns warnings into errors}
% \changes{v0.0.2}{2023/07/04}{Minor changes in the documentation}
% \changes{v0.0.3}{2026/07/13}{Promote expl3 warnings to errors too}

% Classic \LaTeXe{} warnings travel through |\GenericWarning|, so the package
% reroutes them to |\GenericError|:
%    \begin{macrocode}
\message{fail-fast: Starting from now all warnings
  are reported as errors^^J}%
\renewcommand{\GenericWarning}[2]{%
  \GenericError{#1}{#2}{}{This was a warning, now an error}%
}
%    \end{macrocode}

% A growing share of \LaTeX{} rides on expl3, whose warnings from
% |\msg_warning:nn| and its siblings never touch |\GenericWarning|. Redirecting
% the whole |warning| class to |error| catches every variant at once:
%    \begin{macrocode}
\ExplSyntaxOn
\msg_redirect_class:nn { warning } { error }
\ExplSyntaxOff
%    \end{macrocode}

% One family of warnings resists promotion: Overfull and Underfull |\hbox| and
% |\vbox| reports come straight from the \TeX{} box packer, expose no macro
% hook, and therefore remain warnings.

% \Finale

%\clearpage
%
%\PrintChanges
%\clearpage
%\PrintIndex
