try { // Some code that may throw an exception } catch (Exception $e) { $errorMessage = $e->getErrorMessage(); // Display or log the error message }In this example, the code tries to execute some operation that may throw an exception. If an exception is thrown, it is caught and the error message is retrieved using the `getErrorMessage` function. This error message can then be displayed to the user or logged for later analysis. Package/library: This is a native PHP function and does not belong to any particular package or library.