What are the potential pitfalls of not handling exceptions properly when creating custom exceptions in PHP?

If exceptions are not handled properly when creating custom exceptions in PHP, it can lead to unexpected behavior in the application, making it difficult to debug and maintain. To solve this issue, it is important to catch and handle exceptions appropriately to provide meaningful error messages to the user or log the error for further investigation.

try {
    // Code that may throw custom exception
} catch (CustomException $e) {
    // Handle the custom exception
    echo "An error occurred: " . $e->getMessage();
} catch (Exception $e) {
    // Handle other exceptions
    echo "An unexpected error occurred";
}