- try:
- # DEBUG: print("DEBUG: BEFORE res[]:", type(res))
- if isinstance(res, BaseException) or isinstance(res, json.JSONDecodeError):
- res = str(res)
-
- # DEBUG: print("DEBUG: AFTER res[]:", type(res))
- if type(res) is str:
- # DEBUG: print(f"DEBUG: Setting last_error_details='{res}'");
- cursor.execute("UPDATE instances SET last_status_code = 999, last_error_details = ?, last_updated = ? WHERE domain = ? LIMIT 1", [
- res,
- time.time(),
- domain
- ])
- else:
- # DEBUG: print(f"DEBUG: Setting last_error_details='{res.reason}'");
- cursor.execute("UPDATE instances SET last_status_code = ?, last_error_details = ?, last_updated = ? WHERE domain = ? LIMIT 1", [
- res.status_code,
- res.reason,
- time.time(),
- domain
- ])
-
- if cursor.rowcount == 0:
- # DEBUG: print("DEBUG: Did not update any rows:", domain)
- pending_errors[domain] = res
+ if type(domain) != str:
+ raise ValueError(f"WARNING: domain[]={type(domain)} is not 'str'")
+
+ # DEBUG: print("DEBUG: BEFORE res[]:", type(res))
+ if isinstance(res, BaseException) or isinstance(res, json.JSONDecodeError):
+ res = str(res)
+
+ # DEBUG: print("DEBUG: AFTER res[]:", type(res))
+ nodeinfos["last_updated"][domain] = time.time()
+ if type(res) is str:
+ # DEBUG: print(f"DEBUG: Setting last_error_details='{res}'");
+ nodeinfos["last_status_code"][domain] = 999
+ nodeinfos["last_error_details"][domain] = res
+ else:
+ # DEBUG: print(f"DEBUG: Setting last_error_details='{res.reason}'");
+ nodeinfos["last_status_code"][domain] = res.status_code
+ nodeinfos["last_error_details"][domain] = res.reason