Return proper responses for missing seed ids
This commit is contained in:
@@ -1,21 +1,26 @@
|
||||
namespace ALttPRandomizer.Service {
|
||||
using ALttPRandomizer.Azure;
|
||||
using ALttPRandomizer.Model;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class SeedService {
|
||||
public SeedService(AzureStorage azureStorage) {
|
||||
public SeedService(AzureStorage azureStorage, ILogger<SeedService> logger) {
|
||||
this.AzureStorage = azureStorage;
|
||||
this.Logger = logger;
|
||||
}
|
||||
|
||||
private AzureStorage AzureStorage { get; }
|
||||
private ILogger<SeedService> Logger { get; }
|
||||
|
||||
public async Task<IDictionary<string, object>> GetSeed(string seedId) {
|
||||
var files = await this.AzureStorage.GetFiles(seedId);
|
||||
|
||||
this.Logger.LogDebug("Found files: {@files}", files.Keys);
|
||||
|
||||
var result = new Dictionary<string, object>();
|
||||
|
||||
if (!files.TryGetValue("settings.json", out var settingsData)) {
|
||||
|
||||
Reference in New Issue
Block a user