diff --git a/docs/plugins/hooks.rst b/docs/plugins/hooks.rst index d6d79fb52..3e1801ae6 100644 --- a/docs/plugins/hooks.rst +++ b/docs/plugins/hooks.rst @@ -592,7 +592,7 @@ octoprint.comm.protocol.gcode.received octoprint.comm.protocol.gcode.error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. py:function:: gcode_received_hook(comm_instance, error_message, *args, **kwargs) +.. py:function:: gcode_error_hook(comm_instance, error_message, *args, **kwargs) Get the messages of any errors messages sent by the printer, with the leading ``Error:`` or ``!!`` already stripped. Handlers should return True if they handled that error internally and it should not be processed by @@ -602,6 +602,16 @@ octoprint.comm.protocol.gcode.error Plugins might utilize this hook to handle errors generated by the printer that are recoverable in one way or the other and should not trigger the normal handling that assumes the worst. + **Example:** + + Looks for error messages containing "fan error" or "bed missing" (ignoring case) and marks them as handled by the + plugin. + + .. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/comm_error_handler_test.py + :linenos: + :tab-width: 4 + :caption: `comm_error_handler_test.py `_ + :param MachineCom comm_instance: The :class:`~octoprint.util.comm.MachineCom` instance which triggered the hook. :param str error_message: The error message received from the printer. :return: True if the error was handled in the plugin and should not be processed further, False (or None) otherwise.