async def send_error(self, causing_event: nEvent, error_type: str, error_msg: str = "") -> None:
        """Sends an error as response to the passed nEvent, containing the error type and message"""
        to_pubkey_hex = causing_event.pubkey
        response_to_id = causing_event.id
        res_type = None
        if isinstance(causing_event.content, dict):  # we have replaced the content with the decrypted content
            if 'method' in causing_event.content:
                res_type = causing_event.content['method']
        content = self.get_error_response(error_type, error_msg, res_type)
        await self.send_encrypted_response(to_pubkey_hex, json.dumps(content), response_to_id)
Sends an error as response to the passed nEvent, containing the error type and message
electrum/plugins/nwc/nwcserver.py