django_socio_grpc.exceptions
Handled exceptions raised by socio grpc framework.
this file is almost identical to https://github.com/encode/django-rest-framework/blob/master/rest_framework/exceptions.py But with the grpc code: https://grpc.github.io/grpc/python/grpc.html#grpc-status-code This file will grown to support all the gRPC exception when needed
Module Contents
Classes
A string-like object that can additionally have a code. |
Functions
Descend into a nested data structure, forcing any
lazy translation strings or strings into |
|
API
- django_socio_grpc.exceptions._get_error_details(data, default_code=None)
Descend into a nested data structure, forcing any lazy translation strings or strings into
ErrorDetail.
- django_socio_grpc.exceptions._get_codes(detail)
- django_socio_grpc.exceptions._get_full_details(detail)
- class django_socio_grpc.exceptions.ErrorDetail
Bases:
strA string-like object that can additionally have a code.
Initialization
Initialize self. See help(type(self)) for accurate signature.
- code
None
- __new__(string, code=None)
- __eq__(other)
- __ne__(other)
- __repr__()
- __hash__()
- exception django_socio_grpc.exceptions.ProtobufGenerationException(app_name=None, model_name=None, detail=None)
Bases:
ExceptionClass for Socio gRPC framework protobuff generation exceptions.
Initialization
Initialize self. See help(type(self)) for accurate signature.
- default_detail
‘Unknow’
- __str__()
- exception django_socio_grpc.exceptions.GRPCException(detail=None, code=None)
Bases:
ExceptionBase class for Socio gRPC framework runtime exceptions. Subclasses should provide
.status_codeand.default_detailproperties.Initialization
Initialize self. See help(type(self)) for accurate signature.
- status_code
None
- default_detail
None
- default_code
‘error’
- __str__()
- get_codes()
Return only the code part of the error details.
Eg. {“name”: [“required”]}
- get_full_details()
Return both the message & code parts of the error details.
Eg. {“name”: [{“message”: “This field is required.”, “code”: “required”}]}
- exception django_socio_grpc.exceptions.Unauthenticated(detail=None, code=None)
Bases:
django_socio_grpc.exceptions.GRPCException- status_code
None
- default_detail
None
- default_code
‘not_authenticated’
- exception django_socio_grpc.exceptions.PermissionDenied(detail=None, code=None)
Bases:
django_socio_grpc.exceptions.GRPCException- status_code
None
- default_detail
None
- default_code
‘permission_denied’
- exception django_socio_grpc.exceptions.NotFound(detail=None, code=None)
Bases:
django_socio_grpc.exceptions.GRPCException- status_code
None
- default_detail
None
- default_code
‘not_found’
- exception django_socio_grpc.exceptions.AlreadyExist(detail=None, code=None)
Bases:
django_socio_grpc.exceptions.GRPCException- status_code
None
- default_detail
None
- default_code
‘already_exist’
- exception django_socio_grpc.exceptions.InvalidArgument(detail=None, code=None)
Bases:
django_socio_grpc.exceptions.GRPCException- status_code
None
- default_detail
None
- default_code
‘invalid_argument’
- exception django_socio_grpc.exceptions.Unimplemented(detail=None, code=None)
Bases:
django_socio_grpc.exceptions.GRPCException- status_code
None
- default_detail
None
- default_code
‘unimplemented’