code: def test_insert_error(canned_write_client):
      canned_write_client.post(
          "/data/add_name", {"name": "Hello"}, csrftoken_from=True
      )
      response = canned_write_client.post(
          "/data/add_name_specify_id",
          {"rowid": 1, "name": "Should fail"},
          csrftoken_from=True,
      )
      assert 302 == response.status
      assert (
          "/data/add_name_specify_id?error"
          == response.headers["Location"]
      )
      messages = canned_write_client.ds.unsign(
          response.cookies["ds_messages"], "messages"
      )
      assert [["UNIQUE constraint failed: names.rowid", 3]] == messages
      # How about with a custom error message?
      canned_write_client.ds.config["databases"]["data"]["queries"][
          "add_name_specify_id"
      ]["on_error_message"] = "ERROR"
      response = canned_write_client.post(
          "/data/add_name_specify_id",
          {"rowid": 1, "name": "Should fail"},
          csrftoken_from=True,
      )
      assert [["ERROR", 3]] == canned_write_client.ds.unsign(
          response.cookies["ds_messages"], "messages"
      )
  
imports: from bs4 import BeautifulSoup
  import json
  import pytest
  import re
  from .fixtures import make_app_client, app_client
label_desc: Use image node_id 8 for calling a global function with example usage: test_insert_error(canned_write_client) without return types