Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sonar/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import json
import concurrent.futures
from datetime import datetime
import traceback

from typing import Optional, Union
from http import HTTPStatus
Expand Down Expand Up @@ -1042,6 +1043,7 @@ def export(self, export_settings: types.ConfigSettings, settings_list: Optional[
json_data["settings"] = [s.to_json() for s in settings_dict.values() if with_inherited or not s.inherited and s.key != "visibility"]

except Exception as e:
traceback.print_exc()
util.handle_error(e, f"exporting {str(self)}, export of this project interrupted", catch_all=True)
json_data["error"] = f"{util.error_msg(e)} while exporting project"
log.debug("Exporting %s done, returning %s", str(self), util.json_dump(json_data))
Expand Down
4 changes: 3 additions & 1 deletion sonar/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,8 @@ def dict_remap_and_stringify(original_dict: dict[str, str], remapping: dict[str,

def list_to_dict(original_list: list[dict[str, Any]], key_field: str) -> dict[str, any]:
"""Converts a list to dict with list key_field as dict key"""
if original_list is None:
return original_list
converted_dict = {elem[key_field]: elem for elem in original_list}
for e in converted_dict.values():
e.pop(key_field)
Expand All @@ -740,7 +742,7 @@ def list_to_dict(original_list: list[dict[str, Any]], key_field: str) -> dict[st

def dict_to_list(original_dict: dict[str, Any], key_field: str, value_field: Optional[str] = "value") -> list[str, any]:
"""Converts a dict to list adding dict key in list key_field"""
if isinstance(original_dict, list):
if original_dict is None or isinstance(original_dict, list):
return original_dict
return [{key_field: key, value_field: elem} if not isinstance(elem, dict) else {key_field: key, **elem} for key, elem in original_dict.items()]

Expand Down