# encoding: ascii
# api: powershell
# title: LibrarySqlBackup
# description: The trap statement for this script does not appear to function as suggested.  When I try to run it and force an incorrect file location, it ignores the inner exception that would show the correct error.
# version: 0.1
# author: Chad Miller
# license: CC0
# x-poshcode-id: 1202
# x-archived: 2015-01-07T23:52:09
# x-published: 2010-07-07T14:56:00
#
#
# ---------------------------------------------------------------------------
### From the Apress book "Pro Windows PowerShell" p. 164 I found the following trap handler that will get to the InnerException.Message
# ---------------------------------------------------------------------------
trap
{
    $exceptiontype = $_.Exception.gettype()
    $InnerExceptionType = "no inner exception"
    if($_.Exception.InnerException)
    {
        $InnerExceptionType = $_.Exception.InnerException.GetType()
        # RV - Added following line to display message
        $_.Exception.InnerException.Message
    }

    "FullyQualifiedErrorID: $($_.FullyQualifiedErrorID)"
    "Exception: $exceptionType"
    "InnerException: $innerExceptionType"

    continue
}
