What are some best practices for restructuring error messages in PHP classes to improve efficiency?

Issue: Restructuring error messages in PHP classes can improve efficiency by providing more informative and standardized messages for easier debugging and troubleshooting. Code snippet:

class CustomException extends Exception {
    public function __construct($message, $code = 0, Exception $previous = null) {
        $message = "Custom Error: " . $message;
        parent::__construct($message, $code, $previous);
    }
}

try {
    // Code that may throw an exception
    throw new CustomException("Something went wrong.");
} catch (CustomException $e) {
    echo $e->getMessage();
}