# Path: modernrpc/exceptions.py
# RPC_METHOD_NOT_FOUND = -32601
# 
# RPC_INVALID_PARAMS = -32602
# 
# RPC_INTERNAL_ERROR = -32603
# 
# RPC_INVALID_REQUEST = -32600
# 
# RPC_PARSE_ERROR = -32700
# 
# RPC_CUSTOM_ERROR_BASE = -32099


import json
import random
import re
import xml.etree.cElementTree as ET
import pytest
import requests
from json import JSONDecodeError
from django.core.serializers.json import DjangoJSONEncoder
from modernrpc.exceptions import (
    RPC_METHOD_NOT_FOUND,
    RPC_INVALID_PARAMS,
    RPC_INTERNAL_ERROR,
    RPC_INVALID_REQUEST,
    RPC_PARSE_ERROR,
    RPC_CUSTOM_ERROR_BASE,
)
        "method, params, exc_match, exc_code",
        [
            (
                "non_existing_method",
                [],
                r'Method not found: "non_existing_method"',
                RPC_METHOD_NOT_FOUND,
            ),
            (
                "add",
                [42],
                r"Invalid parameters: add\(\) missing 1 required positional argument",
                RPC_INVALID_PARAMS,
            ),
            (
                "add",
                [5, 9, 6],
                r"Invalid parameters: add\(\) takes 2 positional arguments but 3 were given",
                RPC_INVALID_PARAMS,
            ),
            (
                "divide",
                [50, 0],
                r"Internal error: division by zero",
                RPC_INTERNAL_ERROR,
            ),
            (
                "get_invalid_result",
                [],
                r"Unable to serialize result",

# Path: modernrpc/exceptions.py
# RPC_METHOD_NOT_FOUND = -32601
# 
# RPC_INVALID_PARAMS = -32602
# 
# RPC_INTERNAL_ERROR = -32603
# 
# RPC_INVALID_REQUEST = -32600
# 
# RPC_PARSE_ERROR = -32700
# 
# RPC_CUSTOM_ERROR_BASE = -32099


# Path: tests/functional/test_errors.py
import json
import random
import re
import xml.etree.cElementTree as ET
import pytest
import requests
from json import JSONDecodeError
from django.core.serializers.json import DjangoJSONEncoder
from modernrpc.exceptions import (
    RPC_METHOD_NOT_FOUND,
    RPC_INVALID_PARAMS,
    RPC_INTERNAL_ERROR,
    RPC_INVALID_REQUEST,
    RPC_PARSE_ERROR,
    RPC_CUSTOM_ERROR_BASE,
)

        "method, params, exc_match, exc_code",
        [
            (
                "non_existing_method",
                [],
                r'Method not found: "non_existing_method"',
                RPC_METHOD_NOT_FOUND,
            ),
            (
                "add",
                [42],
                r"Invalid parameters: add\(\) missing 1 required positional argument",
                RPC_INVALID_PARAMS,
            ),
            (
                "add",
                [5, 9, 6],
                r"Invalid parameters: add\(\) takes 2 positional arguments but 3 were given",
                RPC_INVALID_PARAMS,
            ),
            (
                "divide",
                [50, 0],
                r"Internal error: division by zero",
                RPC_INTERNAL_ERROR,
            ),
            (
                "get_invalid_result",
                [],
                r"Unable to serialize result",

                RPC_INTERNAL_ERROR,