Error Severity in SSIS - sql-server-2008

I need to log the Severity of Error in OnErrorCode event handler in SSIS.
Severity can be like : Info, Warning, Critical
I am just curious if anybody knows about how to get this information to log in EventHandler in SSIS and provide any URL which can be useful in looking for this ?

Just to clarify, are you referring to something that is internal to SSIS, or is this some bespoke classification?
In SSIS, there is an OnInformation event and OnWarning event in the same manner that there is an OnError event. Maybe you could consider logging out from these events as well as the OnError event.
As far as I can tell, only OnError will fail your package, unless there is something I am missing.

Related

What is the SSIS Event Handler order of execution?

What is the order of event handler execution in SSIS, please?
For example, I would think OnPreValidate occurs before OnPostValidate. It would be handy if the drop-down list was in the order of execution (if that's possible.)
I searched and didn't find anything yet. For reference for others interested to know what they do, this is Microsoft's BOL page for it.
OnError
OnExecStatusChanged
OnInformation
OnPostExecute
OnPostValidate
OnPreExecute
OnPreValidate
OnProgress
OnQueryCancel
OnTaskFailed
OnVariableValueChanged
OnWarning
Thanks for the help. (I saw an answer for C# here, but not sure if it's the same for SSIS.)

SSIS 2016 system variable System::ErrorDescription missing?

Using SSIs 2016 trying to set an input parameter to a sql task to System::ErrorDescription, but that variable isnt listed. Is this variable not used any longer?
I have sql task that, if it fails, I want to log the error desciption to a table. Yes, I know I can enable logging, but I want also use this message in another task.
[Edit]
I think this variable is only visible within the context of an event handler such as OnError, correct?
The System::ErrorDescription variable is not available for all components, specifically it is only in the OnError, OnInformation, and OnWarning event handlers.
https://learn.microsoft.com/en-us/sql/integration-services/system-variables?view=sql-server-2016

Error: The variable "System::ErrorDescription" was not found in the Variables collection. The variable might not exist in the correct scope

I have created a SSIS package for migrating data from one sql server database to another. The tasks are created in a sequence container.
I have created events in the event handler and added the send mail task for sending email and getting the following error. I get this error even when I try to evaluate the expression in the expression builder. Please note that I am getting the error on the onTaskFailed event handler. I think the system error variables are not accessible in that event. Do I really need that event handler
I can see the variable in the collection. Not sure of how the scope affects it.
This is definitely a scoping issue. The system variable 'ErrorDescription' is only avialable at 'OnError' event handler and can't be used in 'TaskFailed' event handler. As to the question of if you need it or not, that is something your business logic should dictate. I would suggest to move your code to 'OnError' event handler.

Event Handler precedence in SSIS

I have OnPostExecute event handlers on all my control flow elements, but as soon as I put a OnError handler on the package level, I dont see the task level handlers anymore.
Is this a known bug or is it something that I am doing wrong.
This is because the OnPostExecute event handler is created at each package task. The package level indicates an OnPosteExecute event on all tasks.
What do you mean you don't see them? Do you mean that the only thing listed under Event handler in bold is the OnError for the package?
If so, fear not, all of your package OnPostExecute events still exist. The trick is the focus of your cursor when you clicked Event Handlers was on the Package. To see event handler's associated to a given Executable, either click back to the Control flow, click your given executable and then click Event Handler. The easier way is to just use the Executable selector bar and drill into it.
I had defined an OnPostExecute event on my Execute SQL Task so I clicked that and selected OK.
Now I can see the event for that Executable
If you don't want to spend your life clicking through various executables trying to find something, the Package Explorer tab is amazingly helpful in this regard and one that I find people don't use.
Here you can quickly see I defined 2 event handlers on my Execute SQL Task, one for OnPostExecute and one of OnError, in addition to the OnError event I have defined at the package level.
Finally, a quick note about order of operations. Given my scenario of OnError event handlers defined on the control flow elements and the Package level and an OnPostExecute event on the control flow elements, when my Execute SQL Task raises the error (divide by zero), I will see
"Execute SQL Task"'s OnError event fires
"so_EventHandlerRajiv"'s (package) OnError event fires
"Execute SQL Task"'s OnPostExecute event fires
So, OnError will fire before OnPostExecute and one a given Event Handler begins firing, it will percolate up to all the listening handlers.
Maybe you can use the package explorer to see all the defined event handler instead clicking on the properties of each control flow task.
mario
http://msdn.microsoft.com/en-us/library/ms190114.aspx

event listener for flex/air action script errors

I'm trying to add an event listener to my air application that would prevent the "ActionScript error" window from appearing, so I can handle the error within my application.
I was able to find a little information about this from adobe. I'm just not sure what I should be listening for.
It depends quite a lot on what error is thrown, and why.
Your best bet is to carefully read the ActionScript documentation and add listeners to react to all of the errors that have explicit ErrorEvents (such as IOErrorEvent and SecurityErrorEvent). Those are usually related to network and/or file access, and security issues.
For most other errors, there is the try {} catch() {} finally {} statements. This tutorial might be a good place to start.
And if all else fails, there's UncaughtErrorEvent.
But you should really be using that one as a last resort, not as a magic bullet - the best error handling is a) trying to prevent errors from being thrown in the first place (make sure all variables are properly initialized, test for null, etc.), and b) handling expected runtime errors by catching them explicitly, in order to keep the application running and stable.
You have a couple options. As you know, exception handling is not always possible for certain asynchronous operations.
First off, you need to know what object is responsible for the asynchronous operation that is causing the error. The most sensible approach would be to add the necessary error event handlers to this object.
For instance, a URLLoader performs asynchronous operations; and it's failure can only be handled by adding error event listeners. For example:
var loader: URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, completeHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
Another 'catch-all' option is to take advanage of the new UncaughtErrorEvent feature of Flash Player 10.1. For this to work, you need to attach the uncaught error handler to the loader of the main application; this will catch everything! For example:
loader.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, loaderErrorHandler);
private function loaderErrorHandler(e:UncaughtErrorEvent):void {
if(event.error is Error) {
// handle error from embedded SWF
}
// suppress error dialog
e.preventDefault();
}
The last option may not be the best approach as it promotes the swallowing of exceptions instead of addressing and handling the problem properly; nevertheless it can be useful in certain unique circumstances (embedding SWFs).
The window won't appear if you're running the standard version of Flash Player.
It will manifest only as a dialog box on the debugger versions of the
browser plug-ins and stand-alone players, as a message in the output
panel in the authoring player, and as an entry in the log file for
Adobe Flex Builder 3. It will not manifest at all in the release
versions of Flash Player or AIR.
Source : here.