@@ -594,10 +594,6 @@ async sub pre_header_initialize ($c) {
594594 }
595595 );
596596
597- # Warnings in the renderPG subprocess will not be caught by the global warning handler of this process.
598- # So rewarn them and let the global warning handler take care of it.
599- warn $pg -> {warnings } if $pg -> {warnings };
600-
601597 debug(' end pg processing' );
602598
603599 $pg -> {body_text } .= $c -> hidden_field(
@@ -610,18 +606,8 @@ async sub pre_header_initialize ($c) {
610606 $can {showSolutions } &&= $pg -> {flags }{solutionExists };
611607
612608 # Record errors
613- $c -> {pgdebug } = $pg -> {debug_messages } if ref $pg -> {debug_messages } eq ' ARRAY' ;
614- $c -> {pgwarning } = $pg -> {warning_messages } if ref $pg -> {warning_messages } eq ' ARRAY' ;
615- $c -> {pginternalerrors } = $pg -> {internal_debug_messages } if ref $pg -> {internal_debug_messages } eq ' ARRAY' ;
616- # $c->{pgerrors} is defined if any of the above are defined, and is nonzero if any are non-empty.
617- $c -> {pgerrors } = @{ $c -> {pgdebug } // [] } || @{ $c -> {pgwarning } // [] } || @{ $c -> {pginternalerrors } // [] }
618- if defined $c -> {pgdebug } || defined $c -> {pgwarning } || defined $c -> {pginternalerrors };
619-
620- # If $c->{pgerrors} is not defined, then the PG messages arrays were not defined,
621- # which means $pg->{pgcore} was not defined and the translator died.
622- warn ' Processing of this PG problem was not completed. Probably because of a syntax error. '
623- . ' The translator died prematurely and no PG warning messages were transmitted.'
624- unless defined $c -> {pgerrors };
609+ $c -> {pgdebug } = $pg -> {debug_messages } if ref $pg -> {debug_messages } eq ' ARRAY' ;
610+ $c -> {pgwarning } = $pg -> {warning_messages } if ref $pg -> {warning_messages } eq ' ARRAY' ;
625611
626612 # Store fields
627613 $c -> {want } = \%want ;
@@ -635,53 +621,6 @@ async sub pre_header_initialize ($c) {
635621 return ;
636622}
637623
638- sub warnings ($c ) {
639- my $output = $c -> c;
640-
641- # Display warning messages
642- if (!defined $c -> {pgerrors }) {
643- push (
644- @$output ,
645- $c -> tag(
646- ' div' ,
647- $c -> c(
648- $c -> tag(' h3' , style => ' color:red;' , $c -> maketext(' PG question failed to render' )),
649- $c -> tag(' p' , $c -> maketext(' Unable to obtain error messages from within the PG question.' ))
650- )-> join (' ' )
651- )
652- );
653- } elsif ($c -> {pgerrors } > 0) {
654- my @pgdebug = @{ $c -> {pgdebug } // [] };
655- my @pgwarning = @{ $c -> {pgwarning } // [] };
656- my @pginternalerrors = @{ $c -> {pginternalerrors } // [] };
657- push (
658- @$output ,
659- $c -> tag(
660- ' div' ,
661- $c -> c(
662- $c -> tag(' h2' , $c -> maketext(' PG question processing error messages' )),
663- @pgdebug ? $c -> c(
664- $c -> tag(' h3' , $c -> maketext(' PG debug messages' )),
665- $c -> tag(' p' , $c -> c(@pgdebug )-> join ($c -> tag(' br' )))
666- )-> join (' ' ) : ' ' ,
667- @pgwarning ? $c -> c(
668- $c -> tag(' h3' , $c -> maketext(' PG warning messages' )),
669- $c -> tag(' p' , $c -> c(@pgwarning )-> join ($c -> tag(' br' )))
670- )-> join (' ' ) : ' ' ,
671- @pginternalerrors ? $c -> c(
672- $c -> tag(' h3' , $c -> maketext(' PG internal errors' )),
673- $c -> tag(' p' , $c -> c(@pginternalerrors )-> join ($c -> tag(' br' )))
674- )-> join (' ' ) : ' '
675- )-> join (' ' )
676- )
677- );
678- }
679-
680- push (@$output , $c -> SUPER::warnings());
681-
682- return $output -> join (' ' );
683- }
684-
685624sub head ($c ) {
686625 return ' ' if ($c -> {invalidSet });
687626 return $c -> {pg }{head_text } if $c -> {pg }{head_text };
@@ -1042,14 +981,7 @@ sub output_problem_body ($c) {
1042981 } else {
1043982 # For students render the body text of the problem with a message about error details.
1044983 return $c -> c(
1045- $c -> tag(
1046- ' div' ,
1047- id => ' output_problem_body' ,
1048- class => ' text-dark' ,
1049- style => ' color-scheme: light' ,
1050- data => { bs_theme => ' light' },
1051- $c -> b($c -> {pg }{body_text })
1052- ),
984+ $c -> tag(' div' , $c -> b($c -> {pg }{body_text })),
1053985 $c -> include(
1054986 ' ContentGenerator/Base/error_output' ,
1055987 error => $c -> {pg }{errors },
0 commit comments