/* Function for indicating error to the application. 
This function will fetch the event handler based on the UUID of the service being discovered. (The event handler is registered by the application beforehand). The error code is added to the pending events together with the event handler. If no event handler was found, then this function will do nothing. */
static void discovery_error_evt_trigger(ble_db_discovery_t *const p_db_discovery, uint32_t err_code, uint16_t const conn_handle)
/* Function for indicating error to the application. 
This function will fetch the event handler based on the UUID of the service being discovered. (The event handler is registered by the application beforehand). The error code is added to the pending events together with the event handler. If no event handler was found, then this function will do nothing. */
static void discovery_error_evt_trigger(ble_db_discovery_t *const p_db_discovery, uint32_t err_code, uint16_t const conn_handle)
{
    ble_db_discovery_evt_handler_t p_evt_handler;
    ble_gatt_db_srv_t            * p_srv_being_discovered;
    p_srv_being_discovered = &(p_db_discovery->services[p_db_discovery->curr_srv_ind]);
    p_evt_handler = registered_handler_get(&(p_srv_being_discovered->srv_uuid));
    if (p_evt_handler != NULL)
    {
        ble_db_discovery_evt_t evt;
        evt.conn_handle     = conn_handle;
        evt.evt_type        = BLE_DB_DISCOVERY_ERROR;
        evt.params.err_code = err_code;
        p_evt_handler(&evt);
    }
}