(
    endpoint: str,
    detail: str,
    code: str = "invalid",
    type: str = "validation_error",
    attr: Optional[str] = None,
    status_code: int = status.HTTP_400_BAD_REQUEST,
)
return JsonResponse({"type": type, "code": code, "detail": detail, "attr": attr}, status=status_code,)
Generates a friendly JSON error response in line with drf-exceptions-hog for endpoints not under DRF.
Generates a friendly JSON error response in line with drf-exceptions-hog for endpoints not under DRF.
Generates a friendly JSON error response in line with drf - exceptions - hog for endpoints not under DRF .
def generate_exception_response(
    endpoint: str,
    detail: str,
    code: str = "invalid",
    type: str = "validation_error",
    attr: Optional[str] = None,
    status_code: int = status.HTTP_400_BAD_REQUEST,
) -> JsonResponse:
    """
    Generates a friendly JSON error response in line with drf-exceptions-hog for endpoints not under DRF.
    """

    from posthog.internal_metrics import incr

    incr(f"posthog_cloud_raw_endpoint_exception", tags={"endpoint": endpoint, "code": code, "type": type, "attr": attr})
    return JsonResponse({"type": type, "code": code, "detail": detail, "attr": attr}, status=status_code,)
def generate_exception_response ( endpoint : str , detail : str , code : str = "invalid" , type : str = "validation_error" , attr : Optional [ str ] = None , status_code : int = status . HTTP_400_BAD_REQUEST , ) -> JsonResponse : from posthog . internal_metrics import incr incr ( f"posthog_cloud_raw_endpoint_exception" , tags = { "endpoint" : endpoint , "code" : code , "type" : type , "attr" : attr } ) return JsonResponse ( { "type" : type , "code" : code , "detail" : detail , "attr" : attr } , status = status_code , )