Skip to content

Rework PG error/warning/debug message handling.#2935

Open
drgrice1 wants to merge 1 commit intoopenwebwork:developfrom
drgrice1:pg-message-rework
Open

Rework PG error/warning/debug message handling.#2935
drgrice1 wants to merge 1 commit intoopenwebwork:developfrom
drgrice1:pg-message-rework

Conversation

@drgrice1
Copy link
Member

The PG messages are now dealt with completely separately from the webwork2 general warning handling. Furthermore PG warnings and debug messages are separately dealt with.

The PG internal_debug_messages are no longer dealt with at all. They are unnecessary and inappropriately named, and will be removed from PG.

Also, handling of the warnings is now much more consistent in all of the different places that problems are rendered. In fact, they all use the new templates/ContentGenerator/Base/problem_warning_and_debug_output.html.ep template for this.

All of this output is no longer wrapped in a code tag. That is the wrong thing for this. None of it is code. It also causes problems with openwebwork/pg#1384.

@drgrice1
Copy link
Member Author

Note that this pull request is necessary to test openwebwork/pg#1386. However, this pull request does not require that one. So this pull request can be tested with @somiaj's pull request referenced above.

@drgrice1
Copy link
Member Author

Here is a problem you can use to test the various warnings:

DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl', 'PGcourse.pl');

# This is a general Perl warning obviously.
warn 'warning issued from problem';

$a    = Compute(3);
$aCmp = $a->cmp;

BEGIN_PGML
[% This issues a PGalias.pm file not found warning. %]
[!image not found!]{'invalid-image.png'}{300}

[_]{ name => 'badAnswerName' }
END_PGML

NAMED_ANS('badAnswerName', $aCmp);

# This issues a PGresponsegroup::insert_response undefined or empty response
# label warning.
INSERT_RESPONSE('badAnswerName');

# This issues a PGresponsegroup::insert_response existing answer label warning.
INSERT_RESPONSE('badAnswerName', 'badAnswerName', 6);

# This issues a PGresponsegroup::extend_response response label not provided
# warning.
EXTEND_RESPONSE('badAnswerName');

# This issues a PGresponsegroup::extend_response invalid value type warning.
EXTEND_RESPONSE('badAnswerName', 'badAnswerName', 6);

ENDDOCUMENT();

@drgrice1
Copy link
Member Author

Also, you can test debugging messages with the check boxes that appear when viewing a problem in a set as an admin user. You can also test debugging messages with @somiaj's pull request and a problem that has formula diagnostics enabled.

Copy link
Contributor

@somiaj somiaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

The PG messages are now dealt with completely separately from the
webwork2 general warning handling. Furthermore PG warnings and debug
messages are separately dealt with.

The PG `internal_debug_messages` are no longer dealt with at all.  They
are unnecessary and inappropriately named, and will be removed from PG.

Also, handling of the warnings is now much more consistent in all of
the different places that problems are rendered. In fact, they all use
the new `templates/ContentGenerator/Base/problem_warning_and_debug_output.html.ep`
template for this.

All of this output is no longer wrapped in a `code` tag.  That is the
wrong thing for this. None of it is code. It also causes problems with
openwebwork/pg#1384.
@drgrice1 drgrice1 force-pushed the pg-message-rework branch from bee704d to 01f4401 Compare March 24, 2026 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants