From 353de601585d69989a5fd76e56795dbcb12badc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Pei=C3=9Fl?= <7underlines@gmail.com> Date: Tue, 2 May 2023 21:54:57 +0200 Subject: [PATCH] examples: fix unset reader notice for the smtp/mail example (#17998) --- examples/smtp/mail.v | 4 ++-- vlib/net/smtp/smtp.v | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/smtp/mail.v b/examples/smtp/mail.v index c26be33bdd..dddce815ec 100644 --- a/examples/smtp/mail.v +++ b/examples/smtp/mail.v @@ -31,6 +31,6 @@ fn main() { body_type: .html body: body } - mut client := smtp.new_client(client_cfg) or { panic('Error configuring smtp') } - client.send(send_cfg) or { panic('Error resolving email address') } + mut client := smtp.new_client(client_cfg) or { panic('Error with configuring smtp: ${err}') } + client.send(send_cfg) or { panic('Error resolving email address: ${err}') } } diff --git a/vlib/net/smtp/smtp.v b/vlib/net/smtp/smtp.v index 5724583c18..399c416d8b 100644 --- a/vlib/net/smtp/smtp.v +++ b/vlib/net/smtp/smtp.v @@ -33,7 +33,7 @@ pub struct Client { mut: conn net.TcpConn ssl_conn &ssl.SSLConn = unsafe { nil } - reader io.BufferedReader + reader ?&io.BufferedReader pub: server string port int = 25 @@ -139,7 +139,7 @@ fn (mut c Client) connect_ssl() ! { fn (mut c Client) expect_reply(expected ReplyCode) ! { mut str := '' for { - str = c.reader.read_line()! + str = c.reader or { return error('the Client.reader field is not set') }.read_line()! if str.len < 4 { return error('Invalid SMTP response: ${str}') }