Public/Get-specAzTableErrorMessage.ps1
function Get-specAzTableErrorMessage { <# .SYNOPSIS Displays Azure Table Storage error messages based on error numbers. .DESCRIPTION The Get-specAzTableErrorMessage function displays Azure Table Storage error messages based on error numbers. It can be used to handle specific errors and display corresponding messages. .PARAMETER ErrorNumber Specifies the error number for which to retrieve the error message. Type the error number as a string. .PARAMETER StorageAccount Specifies the Azure Storage Account name associated with the error. Type the storage account name as a string. .PARAMETER tableName Specifies the Azure Table Storage name associated with the error. Type the table name as a string. .EXAMPLE Get-specAzTableErrorMessage -ErrorNumber 501 -StorageAccount 'MyStorageAccount' -tableName 'MyTable' Displays a terminating error message for error number 501 indicating that the storage account 'MyStorageAccount' was not found. .NOTES Author: owen.heaume Version: - 1.0 - Initial release - 1.1 - Add check to see if version number is an integer as if it was an array then a terminating error is thrown. #> [cmdletbinding()] param ( [parameter(mandatory = $false)] $ErrorNumber, [parameter(mandatory = $true)] [string]$StorageAccount, [parameter(mandatory = $true)] [string]$tableName ) if ($ErrorNumber -is [int]){ switch ($ErrorNumber) { 501 { throw "TERMINATING ERROR: Storage account $StorageAccount was not found." } 502 { throw "TERMINATING ERROR: Table $tableName was not found." } 601 { throw "TERMINATING ERROR: An error occurred during the add process." } 602 { throw "TERMINATING ERROR: Table $tableName was not found." } 603 { throw "TERMINATING ERROR: Storage account $StorageAccount was not found." } 604 { throw "TERMINATING ERROR: An unknown web exception error occured." } default { write-host "OK" -ForegroundColor darkgreen } } } else { write-host "OK" -ForegroundColor darkgreen } } |