You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before submitting your issue for the CosmosDB project, please take a moment to provide the following details:
Version of PowerShell you're using
$PSVersionTable.PSVersion
Major - Minor - Build - Revision
5 - 1 - 16299 - 492
PowerShell host you're using (eg. Console Host, ISE, Visual Studio)
ISE
Operating system you're running
Windows 10 Enterprise:
[System.Environment]::OSVersion.Version
Major - Minor - Build - Revision
10 - 0 - 16299 - 0
Version of CosmosDB you're using (use Get-Module -Name CosmosDB)
2.1.1.498
I'm creating a script to automate the process of creating a new environment and seed all data.
If something goes wrong, I want to be able to re-run the script. Therefore I need to check if my database is already created:
Get-CosmosDbDatabase -Context $cosmosDbContext -Id 'Maskin' -ErrorVariable ev -ErrorAction SilentlyContinue
If the database doesnt exist, I get a 404. I dont want this to break my script. Therefore I want to silently continue and move on:
if($ev -ne $null) -> create the database.
If i use -ErrorAction SilentlyContinue, the scripts seems to hang.
Workaround is to use try/catch.
The text was updated successfully, but these errors were encountered:
Thanks for raising this @dannythunder - I'll get this sorted. Might be to do with how the exceptions are being handled. I'll check this is flowing through.
Before submitting your issue for the CosmosDB project, please take a moment to provide the following details:
$PSVersionTable.PSVersion
Major - Minor - Build - Revision
5 - 1 - 16299 - 492
ISE
Windows 10 Enterprise:
[System.Environment]::OSVersion.Version
Major - Minor - Build - Revision
10 - 0 - 16299 - 0
Get-Module -Name CosmosDB
)2.1.1.498
I'm creating a script to automate the process of creating a new environment and seed all data.
If something goes wrong, I want to be able to re-run the script. Therefore I need to check if my database is already created:
Get-CosmosDbDatabase -Context $cosmosDbContext -Id 'Maskin' -ErrorVariable ev -ErrorAction SilentlyContinue
If the database doesnt exist, I get a 404. I dont want this to break my script. Therefore I want to silently continue and move on:
if($ev -ne $null)
-> create the database.If i use
-ErrorAction SilentlyContinue
, the scripts seems to hang.Workaround is to use try/catch.
The text was updated successfully, but these errors were encountered: