dbx icon indicating copy to clipboard operation
dbx copied to clipboard

[BUG] non-failsafe get operations in preprocessors

Open renardeinside opened this issue 3 years ago • 0 comments
trafficstars

Sometimes when users provide configurations with incorrect indentation, the following error might occur:

│    35 class PolicyNameProcessor(AbstractProcessor):                                              │
│    36 │   def process(self, object_reference: Dict[str, Any]):                                   │
│ ❱  37 │   │   policy_name = object_reference.get("policy_name")                                  │
│    38 │   │                                                                                      │
│    39 │   │   if policy_name:                                                                    │
│    40 │   │   │   dbx_echo(f"Processing policy name {policy_name}")                              │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ object_reference = None                                                                      │ │
│ │             self = <dbx.utils.named_properties.PolicyNameProcessor object at 0x7f880c0ffa30> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'NoneType' object has no attribute 'get'

renardeinside avatar Sep 13 '22 11:09 renardeinside