You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/12/03 10:47:03 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #12764: Improve error handling in cli and introduce consistency

mik-laj commented on a change in pull request #12764:
URL: https://github.com/apache/airflow/pull/12764#discussion_r535088301



##########
File path: airflow/cli/commands/connection_command.py
##########
@@ -140,20 +136,19 @@ def connections_export(args):
             _, filetype = os.path.splitext(args.file.name)
             filetype = filetype.lower()
             if filetype not in allowed_formats:
-                msg = (
-                    f"Unsupported file format. "
-                    f"The file must have the extension {', '.join(allowed_formats)}"
+                raise SystemExit(
+                    f"Unsupported file format. The file must have "
+                    f"the extension {', '.join(allowed_formats)}."
                 )
-                raise SystemExit(msg)
 
         connections = session.query(Connection).order_by(Connection.conn_id).all()
         msg = _format_connections(connections, filetype)
         args.file.write(msg)
 
         if _is_stdout(args.file):
-            print("Connections successfully exported.", file=sys.stderr)
+            print(f"Connections successfully exported to {args.file.name}.")
         else:
-            print(f"Connections successfully exported to {args.file.name}")
+            print("Connections successfully exported.", file=sys.stderr)

Review comment:
       If we display the output on stdout, we cannot write another message to that stream.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org