[PD] Ability to access error messages from patch

Miller Puckette msp at ucsd.edu
Thu Jun 17 22:56:35 CEST 2021


On Thu, Jun 17, 2021 at 12:54:40PM +0100, Claude Heiland-Allen wrote:
> Hi all,
> 
> On 17/06/2021 12:25, IOhannes m zmoelnig wrote:
> ...
> > Pd is a data flow language and I thikn the per-canvas paradigm maps well
> > to the idea of data "passing through a danger zone" - which it can also
> > leave as well.
> ...
> > however, I do like oliver's idea of hooking up such a [catch]-like
> > object in the object-tree.
> ...
> 
> Both have their merits, I suppose the depth first flow version could benefit
> from another object to uninstall the error handler, making it able to
> emulate the per-canvas mechanism.
> 
> A feature like "(re-)throw error/exception to parent" could be useful in
> both cases; with top-level unhandled errors getting printed in the console.?
> And a "throw error to current exception handler" would be useful too.
> 
> This proliferation of objects makes me think that it could be useful to have
> an [error foo] set of objects, like [list].
> 
> 
> Something like this perhaps (swap outlet order if you like, doesn't bother
> me)
> 
> ?|
> [error begin? ]
> ?|?? ? ? ? ? |
> [foo]????? recover from bar and baz errors (apart from error 42 from bar) as
> well as errors from foo
> ?|
> [error begin ?? ? ]
> ?|???????? ?? |
> [bar] ?? ? ?? [route 42???????? ? ? ? ???? ]
> ?|?? ????? ?? |??? ? ? ? ? ? ? ? ?? ? ?? ? |
> [error end]? recover from bar error 42 ? ? [error throw]
> ?|
> [baz]
> ? |
> 
> 
> Claude

Well, how about just adding capabilities to the pdcontrol object.

What I'm imagining is:

[pdcontrol catch-printout [mask]] - send this a bang, and a bang comes out
the (left?) outlet.  This would catches whatever post(), warn(), error(),
etc, messages occur while handling the "bang" outlet and send it to the
printout-outlet.  The message coming out could be:

<type> <error-name>

or if in "verbose" mode, it would be:

<type> <error-name> <text of message parsed as a Pd list>

The error-name would be a symbol such as "open-failed".  If any of the
existing post(), warn(), error(), or pd_error() got called, this would just
be "print", "warning", or "error".  A new chocolate-flavored pd_erport_error()
would allow the reporting object to specify the error symbol.

A creation flag to pdcontrol would simply allow all messages to be output,
symbol table pollution notwithstanding, for those situations where you can't
get a Pd window or stderr (patches inside Camomile for example).

cheers
Miller





More information about the Pd-list mailing list