Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Whoops debugging as error docs - MDL-80206 #819

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions general/development/tools/exceptiontracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: Exception Tracing
tags:
- tools
- debugging
- exceptions
---

<Since versions={["4.4"]} issueNumber={"MDL-79974"} />
Expand All @@ -26,6 +28,14 @@ The whoops UI is only used when the following conditions are met:
- the `$CFG->debug_developer_use_pretty_exceptions` value is not `false`
- the whoops library is available (using `composer install`)

## Debugging messages

Moodle typically show debugging messages created with the `debugging()` method inline, however this can be easy to miss.

If Whoops is configured then `debugging()` messages will instead trigger an error and be shown using the Whoops UI.

This can be controlled using the `$CFG->debug_developer_debugging_as_error` setting.

## Configuration

The use of whoops, and some features of it, are configurable to suit your personal preferences.
Expand Down Expand Up @@ -75,4 +85,20 @@ For full documentation on this feature, see the [whoops documentation](https://g

:::

### Treating debugging as an error

In normal circumstances Moodle will treat all calls to `debugging()` as an informational message which is shown inline in the page body.

You may wish to treat these as Errors instead, especially when updating code between Moodle versions.

The default behaviour for `debugging()` is:

- if the whoops UI is installed, and available, then treat `debugging()` as an Error;
- otherwise treat `debugging()` as an informational message only.

Thi scan be further configured by setting the `$CFG->debug_developer_debugging_as_error` property:

- `$CFG->debug_developer_debugging_as_error = true;` - always treat debugging calls as an error, whether whoops is available or not;
- `$CFG->debug_developer_debugging_as_error = false;` - never treat debugging calls as an Error, even when whoops is available.

<!-- cspell:ignore macvim,textmate -->
Loading