Skip to content
Snippets Groups Projects
Verified Commit 3a8531e7 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

FIX: #96 Better error output for crawl.py script.

parent e685b72e
No related branches found
No related tags found
2 merge requests!178FIX: #96 Better error output for crawl.py script.,!176misc. small changes
Pipeline #52528 passed
...@@ -55,6 +55,9 @@ from linkahead.apiutils import (compare_entities, ...@@ -55,6 +55,9 @@ from linkahead.apiutils import (compare_entities,
merge_entities) merge_entities)
from linkahead.cached import cache_clear, cached_get_entity_by from linkahead.cached import cache_clear, cached_get_entity_by
from linkahead.common.datatype import get_list_datatype, is_reference from linkahead.common.datatype import get_list_datatype, is_reference
from linkahead.exceptions import (
TransactionError,
)
from linkahead.utils.escape import escape_squoted_text from linkahead.utils.escape import escape_squoted_text
from .config import get_config_setting from .config import get_config_setting
...@@ -1081,15 +1084,24 @@ def crawler_main(crawled_directory_path: str, ...@@ -1081,15 +1084,24 @@ def crawler_main(crawled_directory_path: str,
logger.error(err) logger.error(err)
_update_status_record(crawler.run_id, 0, 0, status="FAILED") _update_status_record(crawler.run_id, 0, 0, status="FAILED")
return 1 return 1
except TransactionError as err:
logger.debug(traceback.format_exc())
logger.error(err)
logger.error("Transaction error details:")
for suberr in err.errors:
logger.error("---")
logger.error(suberr.msg)
logger.error(suberr.entity)
return 1
except Exception as err: except Exception as err:
logger.debug(traceback.format_exc()) logger.debug(traceback.format_exc())
logger.debug(err) logger.error(err)
if "SHARED_DIR" in os.environ: if "SHARED_DIR" in os.environ:
# pylint: disable=E0601 # pylint: disable=E0601
domain = get_config_setting("public_host_url") domain = get_config_setting("public_host_url")
logger.error("Unexpected Error: Please tell your administrator about this and provide the" logger.error("Unexpected Error: Please tell your administrator about this and provide "
f" following path.\n{domain}/Shared/" + debuglog_public) f"the following path.\n{domain}/Shared/" + debuglog_public)
_update_status_record(crawler.run_id, 0, 0, status="FAILED") _update_status_record(crawler.run_id, 0, 0, status="FAILED")
return 1 return 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment