From b3ba53889f1ae98aed397e23004648cdde801406 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 18 Oct 2022 13:36:44 +1300 Subject: [PATCH] Fix language negotiation exception to be standard --- Civi/Core/Locale.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Civi/Core/Locale.php b/Civi/Core/Locale.php index 9a02cd130d..709a37bcc0 100644 --- a/Civi/Core/Locale.php +++ b/Civi/Core/Locale.php @@ -169,11 +169,12 @@ class Locale { * Ex: `en_US`, `es_ES`, `fr_CA` * @return \Civi\Core\Locale * The effective locale specification. + * @throws \CRM_Core_Exception */ public static function negotiate(string $preferred): Locale { // Create a locale for the requested language if (!preg_match(';^[a-z][a-z]_[A-Z][A-Z]$;', $preferred)) { - throw new \RuntimeException("Cannot instantiate malformed locale: $preferred"); + throw new \CRM_Core_Exception("Cannot instantiate malformed locale: $preferred"); } $systemDefault = \Civi::settings()->get('lcMessages'); -- 2.25.1