Skip to content

Commit 3b12036

Browse files
committed
Ongoing work on schema convertor.
1 parent ec4541f commit 3b12036

File tree

4 files changed

+1218
-103
lines changed

4 files changed

+1218
-103
lines changed

DataWarehouseAutomation/DataWarehouseAutomation.sln

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample Metadata", "Sample M
2929
Sample_Metadata\sampleFreeForm.json = Sample_Metadata\sampleFreeForm.json
3030
Sample_Metadata\sampleJsonStagingWithPsaDetails.json = Sample_Metadata\sampleJsonStagingWithPsaDetails.json
3131
Sample_Metadata\sampleMultipleDataItemMappings.json = Sample_Metadata\sampleMultipleDataItemMappings.json
32+
Sample_Metadata\samplePSA.json = Sample_Metadata\samplePSA.json
3233
Sample_Metadata\sampleSimpleDDL.json = Sample_Metadata\sampleSimpleDDL.json
3334
Sample_Metadata\sampleSourceQuery.json = Sample_Metadata\sampleSourceQuery.json
3435
EndProjectSection
@@ -50,7 +51,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Examples", "Example_Project
5051
EndProject
5152
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RunDwhAutomation", "RunDwhAutomation\RunDwhAutomation.csproj", "{62C992C6-370D-4591-B54E-2F61E2D8B638}"
5253
EndProject
53-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchemaJsonConverter", "SchemaJsonConverter\SchemaJsonConverter.csproj", "{07214B80-37A9-4137-B0F3-109FA0D0926A}"
54+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SchemaJsonConverter", "SchemaJsonConverter\SchemaJsonConverter.csproj", "{07214B80-37A9-4137-B0F3-109FA0D0926A}"
5455
EndProject
5556
Global
5657
GlobalSection(SolutionConfigurationPlatforms) = preSolution

DataWarehouseAutomation/DataWarehouseAutomation/HandleBarsHelpers.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,19 @@ public static void RegisterHandleBarsHelpers()
364364
throw new HandlebarsException("{{lookupExtension}} helper expects two arguments: a List<Extension> and a string lookup key");
365365
}
366366

367-
var extensionList = JsonSerializer.Deserialize<List<Extension>>(parameters[0].ToString() ?? string.Empty);
368-
var key = (string)parameters[1];
369-
var result = extensionList?.Find(i => i.Key.Equals(key, StringComparison.OrdinalIgnoreCase))?.Value ?? "";
367+
try
368+
{
369+
var extensionList = JsonSerializer.Deserialize<List<Extension>>(parameters[0].ToString() ?? string.Empty);
370+
var key = (string)parameters[1];
371+
var result = extensionList?.Find(i => i.Key.Equals(key, StringComparison.OrdinalIgnoreCase))?.Value ?? "";
370372

371-
writer.WriteSafeString($"{result}");
373+
374+
writer.WriteSafeString($"{result}");
375+
}
376+
catch (Exception exception)
377+
{
378+
throw new HandlebarsException($"{{lookupExtension}} encountered an error: the list of extensions provided as the first argument could not be deserialized. The reported error is :{exception.Message}");
379+
}
372380
});
373381
}
374382
}

0 commit comments

Comments
 (0)