json2graph.modules.errors
Functions related to the verification and treatment of identified ERROR cases.
Module Contents
Functions
|
Reports the error caused when a requirement is not met. As this is a generic function, the error message |
|
Reports the error caused when an invalid parameter is provided to a switch case (if-else statements). |
|
Reports the error caused program cannot read or load the desired content (test_files or directories). |
|
Reports the error caused program cannot save or write the desired content (test_files or directories). |
Attributes
- json2graph.modules.errors.LOGGER
- json2graph.modules.errors.report_error_requirement_not_met(error_message)
Reports the error caused when a requirement is not met. As this is a generic function, the error message parameter must be used to identify the error to the user.
- Parameters:
error_message (str) – Message to be printed to the user indicating the detected error.
- Raises:
ValueError – Always.
- Return type:
None
- json2graph.modules.errors.report_error_end_of_switch(invalid_parameter, caller_function_name)
Reports the error caused when an invalid parameter is provided to a switch case (if-else statements). Used to validate parameters.
NOTE: caller_function_name can be obtained from ‘current_function = inspect.stack()[0][3]’
- Parameters:
invalid_parameter (str) – Invalid function parameter that caused the error.
caller_function_name (str) – Name of the function in which the invalid parameter was used.
- Raises:
ValueError – Always.
- Return type:
None
- json2graph.modules.errors.report_error_io_read(desired_content, file_description, error)
Reports the error caused program cannot read or load the desired content (test_files or directories).
- Parameters:
desired_content (str) – Name of the file used by the IO operation caused the error.
file_description (str) – Description of the file in desired_content.
error (OSError) – Error raised by the IO operation.
- Raises:
OSError – Always.
- Return type:
None
- json2graph.modules.errors.report_error_io_write(desired_content, file_description, error)
Reports the error caused program cannot save or write the desired content (test_files or directories).
- Parameters:
desired_content (str) – Name of the file used by the IO operation caused the error.
file_description (str) – Description of the file in desired_content.
error (OSError) – Error raised by the IO operation.
- Raises:
OSError – Always.
- Return type:
None