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