Re: Validation, error reports, and printing to stderr

Norman Walsh <ndw@nwalsh.com> writes:
> That's all well and good, but following David Cramer's recent
> messages, I think there's still something missing: how do the errors
> get reported?

It's not appropriate for the p:try to report errors that the p:catch
step catches. I'm tempted to try addressing this with a new step:

<p:declare-step type="cx:report-errors">
   <p:input port="source" primary="true"/>
   <p:input port="report" sequence="true"/>
   <p:output port="result"/>
   <p:option name="code"/>
   <p:option name="code-prefix"/>
   <p:option name="code-namespace"/>
   <p:option name="raise-error" select="'false'"/>
</p:declare-step>

It simply copies source to result, like p:identity. If the report port
is not empty, then it sends that report to the error handler (I think
that'll put the messages on STDERR by default and it allows embedding
apps to do something else).

If raise-error is true, it acts like p:error and signals an error.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676
www.marklogic.com

Received on Sunday, 1 January 2012 13:22:19 UTC