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