mirror of
https://github.com/mskatoni/ni-mail.git
synced 2026-08-29 20:18:50 +08:00
17 lines
465 B
Python
17 lines
465 B
Python
from typing import Any, Dict
|
|
|
|
def get_response_details(res) -> str:
|
|
try:
|
|
return res.text[:500]
|
|
except Exception:
|
|
return "No response details"
|
|
|
|
def build_error_payload(code: str, message: str, error_type: str = "APIError", status_code: int = 500, details: Any = None) -> Dict[str, Any]:
|
|
return {
|
|
"code": code,
|
|
"message": message,
|
|
"type": error_type,
|
|
"status": status_code,
|
|
"details": details
|
|
}
|