test-fullautomation / robotframework-robotlog2db

2 stars 1 forks source link

Violation of database schema causes an exception #43

Closed HolQue closed 1 year ago

HolQue commented 1 year ago

By mistake I used a file with a testfileheader_shortdescription that is too long.

This causes an exception.

To react properly on every possible database errors, every database access needs to be encapsulated in try/except.

Traceback (most recent call last):
  File "D:\RobotFramework\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\RobotFramework\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\RobotFramework\python39\lib\site-packages\RobotLog2DB\__main__.py", line 17, in <module>
    RobotLog2DB()
  File "D:\RobotFramework\python39\lib\site-packages\RobotLog2DB\robotlog2db.py", line 1265, in RobotLog2DB
    process_suite(db, result.suite, _tbl_test_result_id, metadata_info, dConfig)
  File "D:\RobotFramework\python39\lib\site-packages\RobotLog2DB\robotlog2db.py", line 732, in process_suite
    process_suite(db, subsuite, _tbl_test_result_id, root_metadata,
  File "D:\RobotFramework\python39\lib\site-packages\RobotLog2DB\robotlog2db.py", line 829, in process_suite
    db.vCreateNewHeader(_tbl_file_id,
  File "D:\RobotFramework\python39\lib\site-packages\RobotLog2DB\CDataBase.py", line 774, in vCreateNewHeader
    self.__arExec(sql,sqlval)
  File "D:\RobotFramework\python39\lib\site-packages\RobotLog2DB\CDataBase.py", line 229, in __arExec
    c.execute(command,values)
  File "D:\RobotFramework\python39\lib\site-packages\MySQLdb\cursors.py", line 206, in execute
    res = self._query(query)
  File "D:\RobotFramework\python39\lib\site-packages\MySQLdb\cursors.py", line 319, in _query
    db.query(q)
  File "D:\RobotFramework\python39\lib\site-packages\MySQLdb\connections.py", line 254, in query
    _mysql.connection.query(self, query)
MySQLdb.DataError: (1406, "Data too long for column 'testfileheader_shortdescription' at row 1")
test-fullautomation commented 1 year ago

solved with #45