Skip to content

Instantly share code, notes, and snippets.

View chiendo97's full-sized avatar

Le Tien Chien chiendo97

  • Ha Noi, Viet Nam
View GitHub Profile
@chiendo97
chiendo97 / catch_exception.py
Created February 20, 2023 15:27
catch_exception
def catch_exception(func):
def inner_function(*args, **kwargs):
# return func(*args, **kwargs)
try:
return func(*args, **kwargs)
except grpc._channel._InactiveRpcError as e:
# print(e.details())
# print(args, kwargs)
args[2].abort(e.code(), details=f"Greeter:{func.__name__} -> {e.details()}")
# raise Exception(f"Greeter: {e.code()}-{e.details()}")
@chiendo97
chiendo97 / logger.py
Created December 30, 2022 08:10
python loguru filter level, log files, handle signle change default level
from __future__ import annotations
import signal
import sys
from types import FrameType
from typing import Optional
import loguru
from loguru import logger as _logger
" Vim color file
" intellij
" Created by chiendo97 with ThemeCreator (https://github.com/mswift42/themecreator)
hi clear
if exists("syntax on")
syntax reset
endif