mstar.utils.client_errors#
Client-visible text for an exception raised while serving a request.
Functions
|
Return |
|
|
|
Replace each absolute file path in |
- mstar.utils.client_errors.client_error_text(exc, what, *, log=logger, type_name=True, traceback=True, refusal=None)[source]#
Return
(text, error_id): what a client may see forexc.A
ValueErrororTypeErroris a refusal raised on purpose, so it keeps its message (prefixed with the type name whentype_name), with absolute paths cut to their base names. Anything else becomesinternal error (error id <id>). Either way the full error and its traceback (left out whentracebackis False, for an error already logged where it happened) go tologas<what> [error id <id>].refusaloverrides that type check, for a caller that knows whether the request was refused.
- mstar.utils.client_errors.exception_status_text(exc, what, *, log=logger)[source]#
(status, text)an OpenAI route answersexcwith: an exception that carries its ownstatus_codeanddetail(anHTTPException) keeps both; aValueErroris a refusal, a 400 (or its own status) with server paths cut to base names, logged as one INFO line; anything else goes throughclient_error_text()(aTypeErrora 400 that keeps its traceback, any other a 500 showing only an error id).whatnames the route.