Skip to content

Commit

Permalink
Include traceback in errors from admin (#1621)
Browse files Browse the repository at this point in the history
Signed-off-by: Yee Hing Tong <[email protected]>
  • Loading branch information
wild-endeavor authored May 8, 2023
1 parent 35e52ef commit 7efde40
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions flytekit/clis/sdk_in_container/pyflyte.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def validate_package(ctx, param, values):

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")
click.secho(f"\tdetails: {e.details()}", fg="magenta")
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 @@ -54,12 +54,11 @@ 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")
click.secho(f"\tReason: {str(e)}", dim=True)
click.secho(f"\tInput Request: {MessageToJson(e.request)}", dim=True)
return
click.secho(f"Failed with Exception: Reason: {e._ERROR_CODE}", fg="red") # noqa

cause = e.__cause__
if cause:
if isinstance(cause, grpc.RpcError):
Expand Down

0 comments on commit 7efde40

Please sign in to comment.