Community forum

Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
Offline LEikelman  
#1 Posted : Tuesday, February 8, 2011 5:56:06 PM(UTC)
LEikelman
Rank: Newbie

Joined: 2/8/2011(UTC)
Posts: 5
Location: Brantford

We are currently running several script (windows host/script files) through VisualCron. When an error happens in the script file we want to communicate back to VisualCron that the task has failed and specify the error message. How can we accomplish this?
Offline Support  
#2 Posted : Tuesday, February 8, 2011 9:52:55 PM(UTC)
Support
Rank: Administration

Joined: 2/23/2008(UTC)
Posts: 7,802

Thanks: 352 times
Was thanked: 212 time(s) in 202 post(s)
What kind of scripting language? VBScript? Bat files?
Henrik
Support
http://www.visualcron.com

Please like VisualCron on facebook!
Offline LEikelman  
#3 Posted : Wednesday, February 9, 2011 3:37:01 PM(UTC)
LEikelman
Rank: Newbie

Joined: 2/8/2011(UTC)
Posts: 5
Location: Brantford

We are using VBScript files.
Offline Support  
#4 Posted : Wednesday, February 9, 2011 5:46:39 PM(UTC)
Support
Rank: Administration

Joined: 2/23/2008(UTC)
Posts: 7,802

Thanks: 352 times
Was thanked: 212 time(s) in 202 post(s)
You could use:

wscript.quit(1)

You can probably also use:

Err.Raise 1

http://stackoverflow.com...row-an-error-in-vbscript

Replace 1 with any exit code. VisualCron captures the exit code. Any other exit code than 0 is a failure. VisualCron uses standard Windows exit code descriptions located in an xml file called ExitCodes.xml.

But you could print any info to standard out or standard error using:

WScript.StdOut.Write("Output text")
WScript.StdErr.Write("Error text")
Henrik
Support
http://www.visualcron.com

Please like VisualCron on facebook!
Offline LEikelman  
#5 Posted : Monday, February 28, 2011 3:50:58 PM(UTC)
LEikelman
Rank: Newbie

Joined: 2/8/2011(UTC)
Posts: 5
Location: Brantford

VisualCron doesn't seem to capture error when I execute:

WScript.StdErr.Write("custom error message")

Use exit codes is not an option as we want to log specific custom error messages about the details of the error and not predefined errors. Is there no way to set the task status to failed and add a reason through the API?
Offline matrixIII  
#6 Posted : Thursday, March 3, 2011 10:28:30 PM(UTC)
matrixIII
Rank: Advanced Member

Joined: 5/21/2010(UTC)
Posts: 61

Was thanked: 2 time(s) in 2 post(s)
You can do...

WScript.StdErr.Write("custom error message")
wscript.quit(1)

Then the 'Result' will say "Failed", 'Output' or 'Output (stderr)' will show your error description (you can double click if it's more than one line).

'Result' will have the predefined error. You can live with it :) or probably create additional lines in the xml file that has all the standard error messages defined. Start from 20000. I think VisualCron uses the xml file to get its descriptions but then you run the risk that this file may be overridden with new releases.

LEikelman wrote:
VisualCron doesn't seem to capture error when I execute:

WScript.StdErr.Write("custom error message")

Use exit codes is not an option as we want to log specific custom error messages about the details of the error and not predefined errors. Is there no way to set the task status to failed and add a reason through the API?

Edited by user Thursday, March 3, 2011 10:29:32 PM(UTC)  | Reason: Not specified

Offline LEikelman  
#7 Posted : Thursday, March 3, 2011 11:02:55 PM(UTC)
LEikelman
Rank: Newbie

Joined: 2/8/2011(UTC)
Posts: 5
Location: Brantford

I can see the custom message in the result column, but if the job runs again it overwrites the result message. Using the "Retrieve Log" function in VisualCron doesn't display the custom error message. Where would I go to retrieve the logged custom error messages in stderr?

Offline Support  
#8 Posted : Friday, March 4, 2011 6:34:39 AM(UTC)
Support
Rank: Administration

Joined: 2/23/2008(UTC)
Posts: 7,802

Thanks: 352 times
Was thanked: 212 time(s) in 202 post(s)
One way is to write the output to file or send an email after each run. But we are also developing a historic tool for output which hopefully will be ready soon.

LEikelman wrote:
I can see the custom message in the result column, but if the job runs again it overwrites the result message. Using the "Retrieve Log" function in VisualCron doesn't display the custom error message. Where would I go to retrieve the logged custom error messages in stderr?


Henrik
Support
http://www.visualcron.com

Please like VisualCron on facebook!
Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Scroll to Top