[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Abort above HANDLER_FATAL_ERROR_LEVEL level user
From: |
Patrice Dumas |
Subject: |
branch master updated: Abort above HANDLER_FATAL_ERROR_LEVEL level user handlers status |
Date: |
Tue, 09 Aug 2022 08:38:35 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new b928a11947 Abort above HANDLER_FATAL_ERROR_LEVEL level user handlers
status
b928a11947 is described below
commit b928a11947054e6b01791f00add3262c6e888f46
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Aug 9 14:38:23 2022 +0200
Abort above HANDLER_FATAL_ERROR_LEVEL level user handlers status
* tp/Texinfo/Common.pm (%default_main_program_customization_options)
tp/Texinfo/Convert/HTML.pm (output), tp/ext/epub3.pm (epub_setup):
if the status returned by a user defined function registered to be
called at a specific stage is above HANDLER_FATAL_ERROR_LEVEL,
or below -HANDLER_FATAL_ERROR_LEVEL stops the processing, otherwise
do not stop.
---
ChangeLog | 11 +++++++++++
doc/customization_api.texi | 8 ++++++--
doc/texinfo.texi | 9 +++++++++
tp/Texinfo/Common.pm | 6 ++++--
tp/Texinfo/Convert/HTML.pm | 15 +++++++++++----
tp/ext/epub3.pm | 4 ++--
6 files changed, 43 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 38a3040519..0a19c307e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2022-08-09 Patrice Dumas <pertusus@free.fr>
+
+ Abort above HANDLER_FATAL_ERROR_LEVEL level user handlers status
+
+ * tp/Texinfo/Common.pm (%default_main_program_customization_options)
+ tp/Texinfo/Convert/HTML.pm (output), tp/ext/epub3.pm (epub_setup):
+ if the status returned by a user defined function registered to be
+ called at a specific stage is above HANDLER_FATAL_ERROR_LEVEL,
+ or below -HANDLER_FATAL_ERROR_LEVEL stops the processing, otherwise
+ do not stop.
+
2022-08-09 Patrice Dumas <pertusus@free.fr>
* tp/ext/tex4ht.pm (tex4ht_prepare): outputing to a null
diff --git a/doc/customization_api.texi b/doc/customization_api.texi
index 5d70f0b561..037dd3e4d1 100644
--- a/doc/customization_api.texi
+++ b/doc/customization_api.texi
@@ -1850,8 +1850,12 @@ tree root element. @var{$stage} is the current stage.
If @var{$status} is not 0 it means that an error occured.
If @var{$status} is positive, the user defined functions should
-have registered an error message. If @var{$status} is negative,
-the converter will emit a non specific error message.
+have registered an error or warning message. If @var{$status} is
+negative, the converter will emit a non specific error message. If the
+@var{$status} is lower than -@code{HANDLER_FATAL_ERROR_LEVEL} or
+higher than @code{HANDLER_FATAL_ERROR_LEVEL}, the processing stops
+immediately. Default value for @code{HANDLER_FATAL_ERROR_LEVEL}
+is 100.
@end deftypefn
diff --git a/doc/texinfo.texi b/doc/texinfo.texi
index d5f4a384b1..f4bd976b64 100644
--- a/doc/texinfo.texi
+++ b/doc/texinfo.texi
@@ -16938,6 +16938,15 @@ menus.
This variable is set to @samp{nomenu} when generating DocBook, or when
@option{--no-headers} is specified.
+@c document?
+@ignore
+@item HANDLER_FATAL_ERROR_LEVEL
+This variable sets the error level above which errors returned by
+user defined functions registered to be called at different stages
+are considered to be fatal errors. You should not need to change this
+value. Default 100.
+@end ignore
+
@item IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME
If set, spaces are ignored after an @@-command that takes braces.
Default true, matching the @TeX{} behavior.
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index f39191b266..5c64082214 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -252,14 +252,16 @@ our %default_main_program_customization_options = (
our %default_converter_customization = (
'TOP_NODE_UP' => '(dir)', # up node of Top node default value
'BASEFILENAME_LENGTH' => 255 - 10,
+ 'DOC_ENCODING_FOR_INPUT_FILE_NAME' => 1,
+ 'DOC_ENCODING_FOR_OUTPUT_FILE_NAME' => 0,
# only used in HTML
'IMAGE_LINK_PREFIX' => undef,
'CASE_INSENSITIVE_FILENAMES' => 0,
'DEBUG' => 0,
+ # only used in HTML
+ 'HANDLER_FATAL_ERROR_LEVEL' => 100,
'TEST' => 0,
'TEXTCONTENT_COMMENT', => undef, # in textcontent format
- 'DOC_ENCODING_FOR_INPUT_FILE_NAME' => 1,
- 'DOC_ENCODING_FOR_OUTPUT_FILE_NAME' => 0,
);
# Some are for all converters, EXTENSION for instance, some for
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 8ebc818da2..76d1406ba2 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -9385,6 +9385,8 @@ sub output($$)
}
$self->set_conf('EXTERNAL_CROSSREF_SPLIT', $self->get_conf('SPLIT'));
+ my $handler_fatal_error_level = $self->get_conf('HANDLER_FATAL_ERROR_LEVEL');
+
if ($self->get_conf('HTML_MATH')
and $self->get_conf('HTML_MATH') eq 'mathjax') {
# See https://www.gnu.org/licenses/javascript-labels.html
@@ -9435,7 +9437,8 @@ sub output($$)
$self->_reset_info();
my $setup_status = $self->run_stage_handlers($root, 'setup');
- return undef unless ($setup_status == 0);
+ return undef unless ($setup_status < $handler_fatal_error_level
+ and $setup_status > -$handler_fatal_error_level);
if ($self->get_conf('HTML_MATH')
and $self->get_conf('HTML_MATH') eq 'mathjax') {
@@ -9534,8 +9537,10 @@ sub output($$)
# set information, to have it ready for
# run_stage_handlers. Some information is not available yet.
$self->_reset_info();
+
my $structure_status = $self->run_stage_handlers($root, 'structure');
- return undef unless ($structure_status == 0);
+ return undef unless ($structure_status < $handler_fatal_error_level
+ and $structure_status > -$handler_fatal_error_level);
my $default_document_language = $self->get_conf('documentlanguage');
@@ -9639,7 +9644,8 @@ sub output($$)
$self->_reset_info();
my $init_status = $self->run_stage_handlers($root, 'init');
- return undef unless ($init_status == 0);
+ return undef unless ($init_status < $handler_fatal_error_level
+ and $init_status > -$handler_fatal_error_level);
if ($self->get_conf('FRAMES')) {
my $status = &{$self->formatting_function('format_frame_files')}($self,
@@ -9867,7 +9873,8 @@ sub output($$)
}
my $finish_status = $self->run_stage_handlers($root, 'finish');
- return undef unless ($finish_status == 0);
+ return undef unless ($finish_status < $handler_fatal_error_level
+ and $finish_status > -$handler_fatal_error_level);
my $extension = '';
$extension = '.'.$self->get_conf('EXTENSION')
diff --git a/tp/ext/epub3.pm b/tp/ext/epub3.pm
index dde3dc5fcf..87e3ba8e54 100644
--- a/tp/ext/epub3.pm
+++ b/tp/ext/epub3.pm
@@ -394,7 +394,7 @@ sub epub_setup($)
and $archive_zip_loading_error) {
$self->document_error($self,
__("Archive::Zip is required for EPUB file output"));
- return 1;
+ return 150;
}
if (not defined($self->get_conf('EPUB_KEEP_CONTAINER_FOLDER'))) {
@@ -492,7 +492,7 @@ sub epub_setup($)
$epub_document_destination_directory, $file, $message));
}
}
- return 1;
+ return 150;
}
return 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Abort above HANDLER_FATAL_ERROR_LEVEL level user handlers status,
Patrice Dumas <=