From 2899869bccf9f0a3b0fa75879c72e909a77133d1 Mon Sep 17 00:00:00 2001 From: Michael Hughes Date: Mon, 8 Jul 2024 15:42:57 +0100 Subject: [PATCH 1/2] Update index.md Added line to indicate a good location for custom exception classes inline with https://github.com/moodle/moodle/blob/main/lib/apis.json#L107 --- general/development/policies/codingstyle/index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/general/development/policies/codingstyle/index.md b/general/development/policies/codingstyle/index.md index d64a2bf8d7..fb2da89070 100644 --- a/general/development/policies/codingstyle/index.md +++ b/general/development/policies/codingstyle/index.md @@ -2054,7 +2054,9 @@ We have a set of custom exception classes. The base class is moodle_exception. Y To get the full list of exception types, search for the regular expression 'class +\w+_exception +extends' or ask your IDE to list all the subclasses of moodle_exception. -Where appropriate, you should create new subclasses of moodle_exception for use in your code. +Where appropriate, you should create new subclasses of moodle_exception for use in your code. + +If you create a custom exception class it *may* live in the `classes/exception/` directory, and be namespaced in `/exception/` A few notable exception types: From dccea7bd493ce8843fb84c084a66c59fa3ad5e1f Mon Sep 17 00:00:00 2001 From: Michael Hughes Date: Tue, 9 Jul 2024 09:05:27 +0100 Subject: [PATCH 2/2] Update general/development/policies/codingstyle/index.md Accepted change Co-authored-by: Andrew Lyons --- general/development/policies/codingstyle/index.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/general/development/policies/codingstyle/index.md b/general/development/policies/codingstyle/index.md index fb2da89070..6f7250534c 100644 --- a/general/development/policies/codingstyle/index.md +++ b/general/development/policies/codingstyle/index.md @@ -2056,6 +2056,9 @@ To get the full list of exception types, search for the regular expression 'clas Where appropriate, you should create new subclasses of moodle_exception for use in your code. + + + If you create a custom exception class it *may* live in the `classes/exception/` directory, and be namespaced in `/exception/` A few notable exception types: