core-extra/daemon/core/gui/errors.py

13 lines
314 B
Python
Raw Normal View History

from tkinter import messagebox
2020-01-14 19:06:52 +00:00
from typing import TYPE_CHECKING
2020-01-14 19:06:52 +00:00
if TYPE_CHECKING:
import grpc
2020-01-10 23:32:16 +00:00
2020-01-14 19:06:52 +00:00
def show_grpc_error(e: "grpc.RpcError"):
title = [x.capitalize() for x in e.code().name.lower().split("_")]
title = " ".join(title)
title = f"GRPC {title}"
messagebox.showerror(title, e.details())