Skip to content

Commit

Permalink
Improving error handling on writing images to manifest.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodrigo Graúdo committed Jun 15, 2018
1 parent 905233e commit 7234cdd
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions Passbook.Generator/PassGenerator.cs
@@ -1,15 +1,15 @@
using Newtonsoft.Json;
using Passbook.Generator.Exceptions;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Security.Cryptography;
using System.Security.Cryptography.Pkcs;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using Newtonsoft.Json;
using Passbook.Generator.Exceptions;
using System.Security.Cryptography.Pkcs;
using System.Text.RegularExpressions;

namespace Passbook.Generator
Expand Down Expand Up @@ -226,9 +226,16 @@ private void GenerateManifestFile(PassGeneratorRequest request)

foreach (KeyValuePair<PassbookImage, byte[]> image in request.Images)
{
hash = GetHashForBytes(image.Value);
jsonWriter.WritePropertyName(image.Key.ToFilename());
jsonWriter.WriteValue(hash);
try
{
hash = GetHashForBytes(image.Value);
jsonWriter.WritePropertyName(image.Key.ToFilename());
jsonWriter.WriteValue(hash);
}
catch (Exception exception)
{
throw new Exception($"Unexpect error writing image on manifest file. Image Key: \"{image.Key}\"", exception);
}
}

foreach (KeyValuePair<string, byte[]> localization in localizationFiles)
Expand Down

0 comments on commit 7234cdd

Please sign in to comment.