diff --git a/application/applicationextension.inc.php b/application/applicationextension.inc.php index f0cdbca53..cbf0b1d6d 100644 --- a/application/applicationextension.inc.php +++ b/application/applicationextension.inc.php @@ -2037,8 +2037,16 @@ class RestUtils elseif (is_string($key)) { // OQL - $oSearch = DBObjectSearch::FromOQL($key); - } + try { + $oSearch = DBObjectSearch::FromOQL($key); + } catch (Exception $e) { + throw new CoreOqlException('Query failed to execute', [ + 'query' => $key, + 'exception_class' => get_class($e), + 'exception_message' => $e->getMessage(), + ]); + } + } else { throw new Exception("Wrong format for key"); diff --git a/setup/modelfactory.class.inc.php b/setup/modelfactory.class.inc.php index f5e3ca672..f2d5d12bc 100644 --- a/setup/modelfactory.class.inc.php +++ b/setup/modelfactory.class.inc.php @@ -952,10 +952,13 @@ class ModelFactory $this->aDictKeys[$sLanguageCode][$sCode] = $oXmlEntry; } } - } - catch (Exception $e) { - throw new Exception('Failed to load dictionary file "'.$sPHPFile.'", reason: '.$e->getMessage()); - } + } catch (Exception|Error $e) // Error can occurs on eval() calls + { + throw new DictException('Failed to load dictionary file "' . $sPHPFile . '"', [ + 'exception_class' => get_class($e), + 'exception_msg' => $e->getMessage(), + ]); + } } catch (Exception $e) { diff --git a/setup/setuputils.class.inc.php b/setup/setuputils.class.inc.php index 6dd91f3df..f15c04f26 100644 --- a/setup/setuputils.class.inc.php +++ b/setup/setuputils.class.inc.php @@ -988,9 +988,18 @@ class SetupUtils return $f; } + /** + * @param float $fBytes size in raw bytes, for example 162594750464.0 + * @return string formatted string, for example "161.62 GB" + * + * @link https://en.wiktionary.org/wiki/byte byte and not Byte + * @link https://en.wikipedia.org/wiki/Kilobyte kB and not KB (IEC 80000-13) + * @link https://en.wiktionary.org/wiki/petabyte petabyte PB + * @link https://en.wiktionary.org/wiki/exabyte exabyte EB + */ public static function HumanReadableSize($fBytes) { - $aSizes = array('bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'HB'); + $aSizes = array('bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB'); $index = 0; while (($fBytes > 1000) && ($index < count($aSizes))) { $index++;