Skip to contentSkip to conversation

send-email: Improve format of smtp initialization error message

PATCH In review Alexander Kuleshov 2 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 send-email: Improve format of smtp initialization error message

---
 git-send-email.perl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
git-send-email.perl +4 -4
index 82c6fea..60dcd8d 100755
@@ -1275,10 +1275,10 @@ X-Mailer: git-send-email $gitversion
 
 		if (!$smtp) {
 			die "Unable to initialize SMTP properly. Check config and use --smtp-debug. ",
-			    "VALUES: server=$smtp_server ",
-			    "encryption=$smtp_encryption ",
-			    "hello=$smtp_domain",
-			    defined $smtp_server_port ? " port=$smtp_server_port" : "";
+			    "\nVALUES: \n\tserver=$smtp_server ",
+			    "\n\tencryption=$smtp_encryption ",
+			    "\n\thello=$smtp_domain",
+			    defined $smtp_server_port ? " \n\tport=$smtp_server_port" : "";
 		}
 
 		smtp_auth_maybe or die $smtp->message;
Signature · 1 line
2.2.1.201.gbbcefff.dirty
#1 lore raw
Quoted 11 lines · Alexander Kuleshov
---
 git-send-email.perl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
git-send-email.perl +0 -0
index 82c6fea..60dcd8d 100755
@@ -1275,10 +1275,10 @@ X-Mailer: git-send-email $gitversion
 

git-send-email.perl X-Mailer: git-send-email $gitversion · line 1281

Quoted 10 lines
git-send-email.perl +4 -4
 		if (!$smtp) {
 			die "Unable to initialize SMTP properly. Check config and use --smtp-debug. ",
-			    "VALUES: server=$smtp_server ",
-			    "encryption=$smtp_encryption ",
-			    "hello=$smtp_domain",
-			    defined $smtp_server_port ? " port=$smtp_server_port" : "";
+			    "\nVALUES: \n\tserver=$smtp_server ",
+			    "\n\tencryption=$smtp_encryption ",
+			    "\n\thello=$smtp_domain",
+			    defined $smtp_server_port ? " \n\tport=$smtp_server_port" : "";

It may be a good convention to have LF at the beginning of a new string (i.e. we terminate the old line only when we have something more to say), but that is true only when we want to end the sentence without the final newline. I wonder if that is true in this case; do we want perl to say "at line # in file X" at the end?

In any case, you have two output lines that ends with a trailing SP just before LF, which is probably not what you wanted.

If we want to see all lines end with LF, it may be far easier to read this way:

	die "msg\n",
            "\tvar1=val1\n",
            "\tvar2=val2\n",
            defined $var3 ? "\tvar3=val3\n" : "";

I dunno.

#2 lore raw

What's about output like this:

Unable to initialize SMTP properly. Check config and use --smtp-debug.

VALUES:

	server=smtp.gmail.com
	encryption=
	hello=localhost.localdomain
	port=587

Junio C Hamano <[email protected]> @ 2014-12-30 00:50 QYZT:

Quoted 36 lines
Quoted 11 lines · Alexander Kuleshov
---
 git-send-email.perl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
git-send-email.perl +0 -0
index 82c6fea..60dcd8d 100755
@@ -1275,10 +1275,10 @@ X-Mailer: git-send-email $gitversion
 

git-send-email.perl X-Mailer: git-send-email $gitversion · line 1281

Quoted 10 lines
git-send-email.perl +4 -4
 		if (!$smtp) {
 			die "Unable to initialize SMTP properly. Check config and use --smtp-debug. ",
-			    "VALUES: server=$smtp_server ",
-			    "encryption=$smtp_encryption ",
-			    "hello=$smtp_domain",
-			    defined $smtp_server_port ? " port=$smtp_server_port" : "";
+			    "\nVALUES: \n\tserver=$smtp_server ",
+			    "\n\tencryption=$smtp_encryption ",
+			    "\n\thello=$smtp_domain",
+			    defined $smtp_server_port ? " \n\tport=$smtp_server_port" : "";

It may be a good convention to have LF at the beginning of a new string (i.e. we terminate the old line only when we have something more to say), but that is true only when we want to end the sentence without the final newline. I wonder if that is true in this case; do we want perl to say "at line # in file X" at the end?

In any case, you have two output lines that ends with a trailing SP just before LF, which is probably not what you wanted.

If we want to see all lines end with LF, it may be far easier to read this way:

Quoted 6 lines
	die "msg\n",
            "\tvar1=val1\n",
            "\tvar2=val2\n",
            defined $var3 ? "\tvar3=val3\n" : "";

I dunno.

--
Best regards.
0xAX

#3 lore raw
Quoted 9 lines · Alex Kuleshov

What's about output like this:

Unable to initialize SMTP properly. Check config and use --smtp-debug.

VALUES:

	server=smtp.gmail.com
	encryption=
	hello=localhost.localdomain
	port=587

Hmmm, maybe I am being slow but what's about it? I thought that was what you are trying to give with your patch since the first iteration.

Puzzled...

Quoted 49 lines

Junio C Hamano <[email protected]> @ 2014-12-30 00:50 QYZT:

Quoted 36 lines
Quoted 11 lines · Alexander Kuleshov
---
 git-send-email.perl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
git-send-email.perl +0 -0
index 82c6fea..60dcd8d 100755
@@ -1275,10 +1275,10 @@ X-Mailer: git-send-email $gitversion
 

git-send-email.perl X-Mailer: git-send-email $gitversion · line 1281

Quoted 10 lines
git-send-email.perl +4 -4
 		if (!$smtp) {
 			die "Unable to initialize SMTP properly. Check config and use --smtp-debug. ",
-			    "VALUES: server=$smtp_server ",
-			    "encryption=$smtp_encryption ",
-			    "hello=$smtp_domain",
-			    defined $smtp_server_port ? " port=$smtp_server_port" : "";
+			    "\nVALUES: \n\tserver=$smtp_server ",
+			    "\n\tencryption=$smtp_encryption ",
+			    "\n\thello=$smtp_domain",
+			    defined $smtp_server_port ? " \n\tport=$smtp_server_port" : "";

It may be a good convention to have LF at the beginning of a new string (i.e. we terminate the old line only when we have something more to say), but that is true only when we want to end the sentence without the final newline. I wonder if that is true in this case; do we want perl to say "at line # in file X" at the end?

In any case, you have two output lines that ends with a trailing SP just before LF, which is probably not what you wanted.

If we want to see all lines end with LF, it may be far easier to read this way:

Quoted 6 lines
	die "msg\n",
            "\tvar1=val1\n",
            "\tvar2=val2\n",
            defined $var3 ? "\tvar3=val3\n" : "";

I dunno.

--
Best regards.
0xAX

#4 lore raw

Yes, like this, but is it suitable for:

Quoted 4 lines
Quoted 4 lines
     die "msg\n",
            "\tvar1=val1\n",
            "\tvar2=val2\n",
            defined $var3 ? "\tvar3=val3\n" : "";

?

I finally got confused, how to print it...

2014-12-30 22:13 GMT+06:00 Junio C Hamano <[email protected]>:

Quoted 67 lines
Quoted 9 lines · Alex Kuleshov

What's about output like this:

Unable to initialize SMTP properly. Check config and use --smtp-debug.

VALUES:

      server=smtp.gmail.com
      encryption=
      hello=localhost.localdomain
      port=587

Hmmm, maybe I am being slow but what's about it? I thought that was what you are trying to give with your patch since the first iteration.

Puzzled...

Quoted 49 lines

Junio C Hamano <[email protected]> @ 2014-12-30 00:50 QYZT:

Quoted 36 lines
Quoted 11 lines · Alexander Kuleshov
---
 git-send-email.perl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
git-send-email.perl +0 -0
index 82c6fea..60dcd8d 100755
@@ -1275,10 +1275,10 @@ X-Mailer: git-send-email $gitversion
 

git-send-email.perl X-Mailer: git-send-email $gitversion · line 1281

Quoted 10 lines
git-send-email.perl +4 -4
            if (!$smtp) {
                    die "Unable to initialize SMTP properly. Check config and use --smtp-debug. ",
-                       "VALUES: server=$smtp_server ",
-                       "encryption=$smtp_encryption ",
-                       "hello=$smtp_domain",
-                       defined $smtp_server_port ? " port=$smtp_server_port" : "";
+                       "\nVALUES: \n\tserver=$smtp_server ",
+                       "\n\tencryption=$smtp_encryption ",
+                       "\n\thello=$smtp_domain",
+                       defined $smtp_server_port ? " \n\tport=$smtp_server_port" : "";

It may be a good convention to have LF at the beginning of a new string (i.e. we terminate the old line only when we have something more to say), but that is true only when we want to end the sentence without the final newline. I wonder if that is true in this case; do we want perl to say "at line # in file X" at the end?

In any case, you have two output lines that ends with a trailing SP just before LF, which is probably not what you wanted.

If we want to see all lines end with LF, it may be far easier to read this way:

Quoted 6 lines
     die "msg\n",
            "\tvar1=val1\n",
            "\tvar2=val2\n",
            defined $var3 ? "\tvar3=val3\n" : "";

I dunno.

--
Best regards.
0xAX

Signature · 2 lines
_________________________
0xAX