database.cursor.execute("SELECT * FROM instances WHERE domain = ? LIMIT 1", [domain])
domain_data = database.cursor.fetchone()
+ if domain_data is None:
+ raise HTTPException(status_code=404, detail=f"domain='{domain}' not found")
+
# Format timestamps
format = config.get("timestamp_format")
instance = dict()