Web Connection
User Thrown Error
Gravatar is a globally recognized avatar based on your email address. User Thrown Error
  Eddie Caldwell
  All
  Mar 10, 2017 @ 11:41am

Dear Rick,

I rolled out web connection 6.10 to our live server and I am getting this error several times a day:

Error: 2071
Message: User Thrown Error .
Details:
Code: RETURN _Out
Program: execscript
Line No: 458
Handled by: mybestserver.OnError()

I found the line of code in wwScripting :: ExecScript and it is:

THROW loException

I looked at my previous version of wwscripting (5.68 i think) and it did not have this line.
Did you put this in for testing and forget to take it out?

Thanks for all your help,

Eddie

Gravatar is a globally recognized avatar based on your email address. re: User Thrown Error
  Rick Strahl
  Eddie Caldwell
  Mar 10, 2017 @ 03:30pm

No - ExecScript is failing and it should throw an exception when it fails 😃 That's the same behavior you'd see when an error occurs in your FoxPro code.

The failure is coming from the code you are executing, so you need to take a look at where you're calling ExecScript(). User thrown error usually means your code threw an exception with Throw and no message perhaps.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: User Thrown Error
  Eddie Caldwell
  Rick Strahl
  Mar 10, 2017 @ 04:15pm

Thanks for your quick reply!

I changed the pagescriptmode from 3 to 1 and the error messages changed to something more helpful.

The problem was a variable I used in a template was not defined.

Thanks

Gravatar is a globally recognized avatar based on your email address. re: User Thrown Error
  Rick Strahl
  Eddie Caldwell
  Mar 10, 2017 @ 07:45pm

Hmmmm... nPageScriptMode=3 shouldn't be doing any ExecScript() calls. nPageScriptMode=1 however will - maybe you mean the other way around?

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: User Thrown Error
  Eddie Caldwell
  Rick Strahl
  Mar 13, 2017 @ 11:38am

I meant Pageparsemode. Sorry.
I can't reproduce the problem today, though it did occur previously on both my local machine and the live machine. I guessed the prg/fxp files it creates did not exist or could not be found until I switched Pageparsemode from 3 to 1, but I tried for a couple of hours to reproduce the error by deleting the compiled prg/fxp files and running the local server in various configurations and was not able to reproduce the problem.
I guess I will chalk it up to ghosts in the machine =)

Gravatar is a globally recognized avatar based on your email address. re: User Thrown Error
  Rick Strahl
  Eddie Caldwell
  Mar 13, 2017 @ 07:01pm

I took another look at this and the "User thrown Error* comes from throw loException. It's funky FoxPro thing that when you explicitly throw an exception the error message is not the actual exception but "User Thrown Error" which is freaking ridiculous 😃 Whoever designed that as FoxPro language feature ought to be hung drawn and quartered...

There are some workarounds for this, but they are all ugly.

Frankly - the better choice if you is: Don't execute script in templates. If you execute script use scripts which don't need to use ExecScript() to execute code blocks (slowly). Scripts natively embed script code so that's a much better approach on all fronts.

+++ Rick ---

© 1996-2024