Problem/Motivation

Steps to reproduce

As part of #2932518: Deprecate watchdog_exception we want to deprecate watchdog_exception. In order to make the deprecation and transition easier, we want to add a constant to 9.4.x.

Proposed resolution

Add a constant for the error message.

Remaining tasks

User interface changes

API changes

The constant Drupal\Core\Utility\Error::DEFAULT_ERROR_MESSAGE has been added to Drupal. It has the value: '%type: @message in %function (line %line of %file).'.

Data model changes

Release notes snippet

CommentFileSizeAuthor
#2 3260044-2.patch8.8 KBkim.pepper

Comments

kim.pepper created an issue. See original summary.

kim.pepper’s picture

Status: Active » Needs review
StatusFileSize
new8.8 KB

Initial patch.

kim.pepper’s picture

Hopefully this is something that can be backported before 10.0.x

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to go, maybe it needs CR but let''s get commiters' feedback to unblock #2932518: Deprecate watchdog_exception

daffie’s picture

Issue summary: View changes

All code changes look good to me.
I have updated the IS and added a CR.
+1 for RTBC.

mfb’s picture

Could/should the constant also be used here in _drupal_log_error():

\Drupal::logger('php')->log($severity, '%type: @message in %function (line %line of %file) @backtrace_string.', $error + ['backtrace' => $backtrace, 'exception' => $exception, 'severity_level' => $severity]); 

It would mean an extra period is added in before @backtrace_string which seems fine (the reader should take a breath before reading the backtrace :)

Ideas for future enhancement: Add a constant that includes <pre class="backtrace">@backtrace</pre> or <pre class="backtrace">@backtrace_string</pre> and standardize on one of those tokens being used for the backtrace string everywhere?

kim.pepper’s picture

I think we should keep the scope of this issue small to just focus on exact replacements.

I've created a follow-up #3260986: Add a constant for watchdog_exception message with a backtrace

alexpott’s picture

Version: 10.0.x-dev » 9.4.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 0415f597980 to 10.0.x and 8ea4547127a to 9.4.x. Thanks!

  • alexpott committed 0415f59 on 10.0.x
    Issue #3260044 by kim.pepper, andypost, daffie, mfb: Add a constant for...

  • alexpott committed 8ea4547 on 9.4.x
    Issue #3260044 by kim.pepper, andypost, daffie, mfb: Add a constant for...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.