Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Controllers/AppController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ public ActionResult<string> sayhello()
var connectionString = app.GetConnectionString("StorageAccount");
if (string.IsNullOrEmpty(connectionString))
{
throw new InvalidOperationException("Storage account connection string is not configured.");
return BadRequest(new {
error = "Storage account connection string is not configured.",
details = "Please configure the 'StorageAccount' connection string in app settings or appsettings.json",
configurationKey = "ConnectionStrings:StorageAccount"
});
}

try
Expand All @@ -94,7 +98,11 @@ public ActionResult<string> sayhello()
}
catch (Exception ex)
{
throw new InvalidOperationException($"Failed to connect to storage account: {ex.Message}", ex);
return StatusCode(500, new {
error = "Failed to connect to storage account",
details = ex.Message,
connectionString = connectionString.Length > 20 ? connectionString.Substring(0, 20) + "..." : connectionString
});
}
}

Expand Down
3 changes: 3 additions & 0 deletions appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
"StorageAccount": "UseDevelopmentStorage=true"
}
}