log unhashable type errors when parsing custom fields
import base64
import re
+from loguru import logger
from typing import Any, List, Union
+from django.conf import settings
from django.contrib.postgres.fields import ArrayField
from django.db import models
@@ -17,6 +19,8 @@ SCRIPT_TYPES = [
("builtin", "Built In"),
]
+logger.configure(**settings.LOG_CONFIG)
+
class Script(BaseAuditModel):
name = models.CharField(max_length=255)
@@ -213,7 +217,12 @@ class Script(BaseAuditModel):
continue
# replace the value in the arg and push to array
+ # log any unhashable type errors
+ try:
temp_args.append(re.sub("\\{\\{.*\\}\\}", value, arg)) # type: ignore
+ except Exception as e:
+ logger.error(e)
+ continue
else:
temp_args.append(arg)
