Main Content

polyspace.ErrorWithLog Class

Namespace: polyspace

(Python) Get error logs from actions on a Polyspace project

Since R2026a

Description

This Python® exception class contains error information from actions on a polyspace.project.Project object. The project-related actions that can throw an exception of this type are:

Creation

Syntax

try:
   statements
except polyspace.ErrorWithLog as errWithLog:
   statements
end

Description

The above syntax executes the statements in the try block and catches resulting errors from Polyspace® project related actions in the except block in a polyspace.ErrorWithLog object errWithLog.

Properties

expand all

Log from a Polyspace action, returned as a polyspace.ExecutionLog object. This object has the following property:

PropertyDescription
Content

Error log content, specified as a single string.

To display the error string from a polyspace.ErrorWithLog object errWithLog in a human readable format, enter:

print(errWithLog.Log.Content)

To save the log content to a file, use the save() method. For instance, to save the error string from a polyspace.ErrorWithLog object errWithLog to a file logs.txt, enter:

errWithLog.Log.save("logs.txt")

Version History

Introduced in R2026a