Skip to content

Commit

Permalink
Remove redundant error message and update exit strategy (#2374)
Browse files Browse the repository at this point in the history
* fix(utils): Remove redundant error prints and update exit strategy

Signed-off-by: Kevin Su <[email protected]>

* fix test

Signed-off-by: Kevin Su <[email protected]>

---------

Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Jan Fiedler <[email protected]>
  • Loading branch information
pingsutw authored and fiedlerNr9 committed Jul 25, 2024
1 parent e199113 commit e99f994
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
4 changes: 1 addition & 3 deletions flytekit/clis/sdk_in_container/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def pretty_print_grpc_error(e: grpc.RpcError):
if isinstance(e, grpc._channel._InactiveRpcError): # noqa
click.secho(f"RPC Failed, with Status: {e.code()}", fg="red", bold=True)
click.secho(f"\tdetails: {e.details()}", fg="magenta", bold=True)
click.secho(f"\tDebug string {e.debug_error_string()}", dim=True)
return


Expand All @@ -103,7 +102,6 @@ def pretty_print_exception(e: Exception):
raise e

if isinstance(e, FlyteException):
click.secho(f"Failed with Exception Code: {e._ERROR_CODE}", fg="red") # noqa
if isinstance(e, FlyteInvalidInputException):
click.secho("Request rejected by the API, due to Invalid input.", fg="red")
cause = e.__cause__
Expand Down Expand Up @@ -140,7 +138,7 @@ def invoke(self, ctx: click.Context) -> typing.Any:
raise e.with_traceback(None)
raise e
pretty_print_exception(e)
raise SystemExit(e) from e
exit(1)


def make_click_option_field(o: click.Option) -> Field:
Expand Down
1 change: 0 additions & 1 deletion tests/flytekit/unit/cli/pyflyte/test_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,4 @@ def test_non_fast_register_require_version(mock_client, mock_remote):
f.close()
result = runner.invoke(pyflyte.main, ["register", "--non-fast", "core3"])
assert result.exit_code == 1
assert str(result.exception) == "Version is a required parameter in case --non-fast is specified."
shutil.rmtree("core3")

0 comments on commit e99f994

Please sign in to comment.