def wrapper(*args, **kwargs):
            try:
                param = None
                errors = []
                arg_dictionary = all_func_args(func, args, kwargs)
                for param in parameters:
                    param_val = arg_dictionary[param.func_param_name]
                    return_val = param.extract_value(param_val)
                    param_errors = param.validate_path(return_val,
                                                       group_errors)
                    if param_errors:
                        errors.append(param_errors)
                        if not group_errors:
                            LOGGER.error(VALIDATE_ERROR_MESSAGE, errors)
                            return failure(errors)
                    elif allow_none_defaults or return_val is not None:
                        kwargs[param.get_var_name()] = return_val
            except Exception as ex:  # noqa: pylint - broad-except
                LOGGER.error(EXCEPTION_LOG_MESSAGE, full_name(ex), str(ex),
                             param.func_param_name if param else UNKNOWN,
                             param.path if param else UNKNOWN)
                return failure(ERROR_MESSAGE)
            else:
                if group_errors and errors:
                    LOGGER.error(VALIDATE_ERROR_MESSAGE, errors)
                    return failure(errors)

                return func(*args, **kwargs)
        def wrapper(*args, **kwargs):
            def update_header(headers, header_name, value, value_type):
                if value:
                    if isinstance(value, value_type):
                        header_key = find_key_case_insensitive(
                            header_name, headers)
                        headers[
                            header_key] = f"{headers[header_key]},{value}" if header_key in headers else value
                    else:
                        LOGGER.error(CORS_INVALID_TYPE_LOG_MESSAGE,
                                     header_name, value_type)
                        raise TypeError

                return headers

            response = func(*args, **kwargs)

            if isinstance(response, dict):
                headers_key = find_key_case_insensitive("headers", response)

                resp_headers = response[
                    headers_key] if headers_key in response else {}

                try:
                    resp_headers = update_header(
                        resp_headers, "access-control-allow-origin",
                        allow_origin, str)
                    resp_headers = update_header(
                        resp_headers, "access-control-allow-methods",
                        allow_methods, str)
                    resp_headers = update_header(
                        resp_headers, "access-control-allow-headers",
                        allow_headers, str)
                    resp_headers = update_header(resp_headers,
                                                 "access-control-max-age",
                                                 max_age, int)

                    response[headers_key] = resp_headers
                    return response
                except TypeError:
                    return failure(CORS_INVALID_TYPE_ERROR,
                                   HTTPStatus.INTERNAL_SERVER_ERROR)
            else:
                LOGGER.error(NON_DICT_LOG_MESSAGE)
                return failure(CORS_NON_DICT_ERROR,
                               HTTPStatus.INTERNAL_SERVER_ERROR)
 def wrapper(*args, **kwargs):
     response = func(*args, **kwargs)
     if "body" in response:
         try:
             response["body"] = json.dumps(response["body"])
         except TypeError:
             return failure(NON_SERIALIZABLE_ERROR_MESSAGE, 500)
     return response
        def wrapper(*args, **kwargs):
            try:
                errors = []
                arg_dictionary = all_func_args(func, args, kwargs)
                for param in parameters:
                    param_val = arg_dictionary[param.func_param_name]
                    param_errors = param.validate(param_val, group_errors)
                    if param_errors:
                        errors.append({param.func_param_name: param_errors})
                        if not group_errors:
                            LOGGER.error(VALIDATE_ERROR_MESSAGE, errors)
                            return failure(errors)
            except Exception as ex:  # noqa: pylint - broad-except
                LOGGER.error(EXCEPTION_LOG_MESSAGE_PATHLESS, full_name(ex),
                             str(ex), param.func_param_name)
                return failure(ERROR_MESSAGE)

            if group_errors and errors:
                LOGGER.error(VALIDATE_ERROR_MESSAGE, errors)
                return failure(errors)

            return func(*args, **kwargs)
        def wrapper(*args, **kwargs):
            response = func(*args, **kwargs)

            if isinstance(response, dict):
                headers_key = find_key_case_insensitive("headers", response)

                resp_headers = response[
                    headers_key] if headers_key in response else {}

                header_key = find_key_case_insensitive(
                    "Strict-Transport-Security", resp_headers)
                header_value = f"max-age={max_age}" if max_age else "max-age=63072000"
                resp_headers[header_key] = header_value
                response[headers_key] = resp_headers
                return response
            else:
                LOGGER.error(NON_DICT_LOG_MESSAGE)
                return failure(HSTS_NON_DICT_ERROR,
                               HTTPStatus.INTERNAL_SERVER_ERROR)
        def wrapper(*args, **kwargs):
            try:
                return func(*args, **kwargs)
            except tuple(
                    handler.exception for handler in
                    handlers) as ex:  # noqa: pylint - catching-non-exception
                failed_handler = [
                    handler for handler in handlers
                    if isinstance(ex, handler.exception)
                ][0]
                message = failed_handler.friendly_message

                if message and str(ex):
                    LOGGER.error("%s: %s", message, str(ex))
                else:
                    LOGGER.error(message if message else str(ex))

                return failure(message if message else str(ex),
                               failed_handler.status_code)
 def wrapper(*args, **kwargs):
     try:
         return func(*args, **kwargs)
     except Exception as ex:  # noqa: pylint - catching-non-exception
         LOGGER.error(str(ex))
         return failure(str(ex))