Error handling - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

LordNullset
Posts: 7
Joined: Mon Nov 26, 2007 5:01 pm

Error handling

I am currently evaluating AI 6.0.1 for use at my company and have come across something I have not found at all in this forum or in the helpfiles: error handling. I have noticed the Execution Properties options for checking error codes, but nowhere I have seen how to access the error codes that are "checked". Can anyone help?

I am also looking for how to prevent installation when run on a virtual machine.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,
I am currently evaluating AI 6.0.1 for use at my company and have come across something I have not found at all in this forum or in the helpfiles: error handling.
Can you please give more details about this? What kind of error handling would you like to do?

Please note that almost all errors are handled automatically by Windows Installer and by Advanced Installer.
I have noticed the Execution Properties options for checking error codes, but nowhere I have seen how to access the error codes that are "checked".
If you are referring to the "Execution Properties" section in the "Properties" page of a custom action then please note that this is handled automatically by Windows Installer depending on the option you select.

You can read more about the available options and how they work here:
http://www.advancedinstaller.com/user-g ... rties.html
Also, you can find more information about Synchronous and Asynchronous Custom Actions here:
http://msdn2.microsoft.com/en-us/library/aa372051.aspx

If this is not what you meant then please give more details about this.
I am also looking for how to prevent installation when run on a virtual machine.
I'm afraid that this feature is not available in Advanced Installer. However, we will consider including it in a future version of Advanced Installer. Thank you for your suggestion.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
LordNullset
Posts: 7
Joined: Mon Nov 26, 2007 5:01 pm

I am currently evaluating AI 6.0.1 for use at my company and have come across something I have not found at all in this forum or in the helpfiles: error handling.
Can you please give more details about this? What kind of error handling would you like to do?

Please note that almost all errors are handled automatically by Windows Installer and by Advanced Installer.
If, for instance, a SQL Script run from a Custom Action returns an error value, I would like to be able to propagate that to another script.

Other than that, you answered all my questions, thank you :)
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

I'm afraid that Windows Installer does not support this.

However, in your custom action you can set a property when an error is encountered. This property will condition another custom action which will handle the error.

Note that the custom action that sets the property must be set to "Immediate" in the "Execution Options" section.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
LordNullset
Posts: 7
Joined: Mon Nov 26, 2007 5:01 pm

clarification

Sorry, gotta be a squeaky wheel again. It seems like you don't know quite what I'm asking, so I will clarify:

I'm trying to run a SQL script that configures a few things in Microsoft SQL Server 2005 Express with Advanced Services. I currently am using a Custom Action under Project Details->Custom Actions->InstallExecuteSequence->Install to call sqlcmd.exe with arguments that specify a .sql file that I included in Project Definition->Files and Folders->Application Data. If this script fails, I want to know why, so I want to extract the error message and error number if an error does occur so I can display (and possibly log) an appropriate message that describes what precisely went wrong. This installer is going to end up on a great many of our clients' servers, and those servers won't be all the same, so the installer needs to be robust.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

This can be done by creating your own custom action (an EXE, a DLL etc.) which wraps the process in which the script runs. This custom action will call "sqlcmd.exe" with the necessary arguments for your script, wait until the script is run and get the return code of the "sqlcmd.exe" process.

This return code will be used in another custom action which performs the actions you need.

Note that Advanced Installer support SQL Script through the "SQL Scripts" page (available only in an Enterprise project). However, if you use this feature then you will not be able to show a custom message to the user.

You can read more about this feature here:
http://www.advancedinstaller.com/user-guide/sql.html
http://www.advancedinstaller.com/user-g ... l-sql.html

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”