ai-content-maker/.venv/Lib/site-packages/openai/cli/_errors.py

24 lines
479 B
Python
Raw Normal View History

2024-05-11 23:00:43 +03:00
from __future__ import annotations
import sys
import pydantic
from ._utils import Colors, organization_info
from .._exceptions import APIError, OpenAIError
class CLIError(OpenAIError):
...
class SilentCLIError(CLIError):
...
def display_error(err: CLIError | APIError | pydantic.ValidationError) -> None:
if isinstance(err, SilentCLIError):
return
sys.stderr.write("{}{}Error:{} {}\n".format(organization_info(), Colors.FAIL, Colors.ENDC, err))