Exception Reporting in Aspose.Cells for Python via .NET

Currently Aspose.Cells for Python via .NET only raises a RunTimeError exception to report exceptions thrown by the underlying .NET library.

Are users expected to catch this error and check the start of the message to determine what exception was actually raised and determine the real problem? Is there any additional metadata attached to the Exception we can use to determine what happened? Is there any way to change this behavior?

Are there any plans to improve the library to raise a Python exception equivalent to the underlying exception?

Thanks,
Kyle

@kmonson
When encountering exceptions while processing files, Aspose.Cells products have their own exception handling mechanism. Please check the following apis.

https://reference.aspose.com/cells/python-net/aspose.cells/cellsexception/
https://reference.aspose.com/cells/python-net/aspose.cells/exceptiontype/

If the program throws a runtime error while processing a file, it is likely that the program has encountered a runtime exception. If you have any questions or confusion, would you like to provide your sample file and test code? We will check it soon.

@kmonson
Hi, here I provide an example to illustrate.
1 . For the following .NET code:

public static void NetExceptionTest()
{
	try
	{
		Workbook workbook = new Workbook();
		Cells cells = workbook.Worksheets[0].Cells;
		cells.SetColumnWidth(0, -0.2);
	}
	catch (Exception e)
	{
		Console.WriteLine(e.GetType() + " : " + e.Message);
	}
}

It throws the following exception message: Aspose.Cells.CellsException : Column width must be between 0 and 255
2 . For the corresponding Python code:

def python_exception_test():
    try:
        workbook = Workbook()
        worksheet = workbook.worksheets[0]
        cells = worksheet.cells
        cells.set_column_width(0, -0.2)
    except Exception as e:
        print(e)

Exception message : Proxy error(CellsException): Column width must be between 0 and 255,
This indicates the type and information of the exception.

Since the CellsException class inherits from the .NET framework, Python cannot have an inheritance or derivation relationship with these classes. It must use its own exception classes such as RuntimeError, and so on.

Hope helps a bit!