Skip to contents

This function parses the draw.io output to detect errors.

Usage

detect.errors(output)

Arguments

output

The output result from the invocation of draw.io, i.e., the standard output and error streams (stdout and stderr) combined. It should be a vector of characters, where each element is a line.

Value

Error lines filtered from the output param, if they exist, or NULL otherwise.

Details

Drawio may encounter errors when invoked, i.e., when exporting a diagram, for example the diagram source file may be incorrect. However, they are not visible to the user, because:

  1. draw.io is an invoked process that knitr does not know about.

  2. draw.io never returns a non-0 code that would indicate an error.

Instead, errors are reported in the output (stdout / stderr). These errors need to be detected automatically by knitrdrawio, so that they can be reported to the user, and eventually stop the knitr process if they are blocking.

Additionally, this function is responsible for ignoring known errors that are not linked to draw.io itself (for example, errors related to dbus or dri3).