input: Write a function to develop an API in Python that fetches data from an SQL database and presents the data in the form of a JSON. The function should connect to a SQLite database named 'database.db', fetch all data from the 'users' table, and return it as a JSON response using Flask.
  assert index()==<should_pass_due_to_valid_SQL_data>
  assert index()==<should_fail_due_to_invalid_SQL_data>
  assert index()=={"message": "No data found"}
output: 
  def index():
      import sqlite3
      import json
      from flask import jsonify
      
      try:
          conn = sqlite3.connect('database.db')
          cursor = conn.cursor()
          cursor.execute("SELECT * FROM users")
          rows = cursor.fetchall()
          conn.close()
          
          if rows:
              return jsonify(rows)
          else:
              return jsonify({"message": "No data found"})
      except Exception as e:
          return jsonify({"error": str(e)})
  