saxon-node icon indicating copy to clipboard operation
saxon-node copied to clipboard

Exception handling

Open seanmcilvenna opened this issue 10 years ago • 6 comments

In my example, I am calling xsltProcessor.compile(xsltLocation) where xsltLocation points to an invalid location. When doing this in Node.JS, even though compile() is wrapped in a try/catch, it is causing the application server to crash. Why is try/catch not catching the errors produced from saxon?

seanmcilvenna avatar Sep 04 '15 20:09 seanmcilvenna

I'm experimenting with repeating this error. Earlier I tried to get the error state back from the saxon with

std::cout<<"exceptionOccurred "<<xp->xsltProcessor->exceptionOccurred()<<std::endl;
            if(xp->xsltProcessor->exceptionOccurred() || xp->xsltProcessor->exceptionCount()>0){
                std::string errorMessage="# of "+std::to_string(xp->xsltProcessor->exceptionCount());
                v8::Isolate::GetCurrent()->ThrowException(v8::Exception::SyntaxError(String::NewFromUtf8(v8::Isolate::GetCurrent(), errorMessage.c_str())));
                args.GetReturnValue().SetUndefined();
                return;

            }

but exceptionOccurred and exceptionCount never return anything and the exeption flies past.

checking if they are catchable...

rimmartin avatar Sep 05 '15 02:09 rimmartin

oops; posted findings in the https://github.com/rimmartin/saxon-node/issues/7 thread

rimmartin avatar Sep 05 '15 02:09 rimmartin

FYI: I'm developing Antlr v4 grammars for xsd and xslt. The http://www.antlr.org/download/antlr-javascript-runtime-4.5.1.zip generated lexer and parser seems fairly strong.

Can get all the xsd defaults and schema info. Not sure where I'm headed yet with this but I found the grammars fairly doable.

rimmartin avatar Sep 05 '15 02:09 rimmartin

Is this thread and thread #7 the same? I am looking into the issue of Saxon/C crashing.

On Sat, Sep 5, 2015 at 3:52 AM, rimmartin [email protected] wrote:

FYI: I'm developing Antlr v4 grammars for xsd and xslt. The http://www.antlr.org/download/antlr-javascript-runtime-4.5.1.zip generated lexer and parser seems fairly strong.

Can get all the xsd defaults and schema info. Not sure where I'm headed yet with this but I found the grammars fairly doable.

— Reply to this email directly or view it on GitHub https://github.com/rimmartin/saxon-node/issues/9#issuecomment-137896411.

ond1 avatar Sep 07 '15 10:09 ond1

Hi @ond1, I posted to the wrong thread about trying to catch or connect to the error handling and exceptions.

rimmartin avatar Sep 07 '15 12:09 rimmartin

What's the latest status of this?

seanmcilvenna avatar Nov 13 '15 19:11 seanmcilvenna