Skip to content

Commit fd27f5d

Browse files
committed
Update the read me to show the use of the new exception types
1 parent 63c4f00 commit fd27f5d

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,30 @@ namespace SHC.DecoderDemo
200200
//Or decode and verify, returning the Smart Health Card as a JSON string, throws exceptions if not valid
201201
//string DecodedSmartHealthCardJson = await Decoder.DecodeToJsonAsync(SmartHealthCardJwsToken, Verify: true);
202202
}
203+
catch (SmartHealthCardSignatureInvalidException SignatureInvalidException)
204+
{
205+
//The decoder successfully validated the JWS signature and found it to be invalid
206+
Console.WriteLine("The SMART Health Card's signing signature is invalid");
207+
Console.WriteLine(SignatureInvalidException.Message);
208+
}
209+
catch (SmartHealthCardJwksRequestException JwksRequestException)
210+
{
211+
//The decoder was unable to retrieved JWKS file that contains the token's public signing key.
212+
//This is likely due to an Internet connectivity issue, the exception message will say more.
213+
Console.WriteLine("The SMART Health Card's public key can not be retrieved.");
214+
Console.WriteLine(JwksRequestException.Message);
215+
}
203216
catch (SmartHealthCardDecoderException DecoderException)
204217
{
205-
Console.WriteLine("The SMART Health Card JWS token was invalid, please see message below:");
218+
//The decoder ran into an error while attempting to decode the JWS token and its SMART Health card payload.
219+
//It is likely that the SMART Health card token is incorrectly structured
220+
Console.WriteLine("The SMART Health Card Decoder has encountered an error, please see message below::");
206221
Console.WriteLine(DecoderException.Message);
207222
}
208223
catch (Exception Exception)
209224
{
210-
Console.WriteLine("Oops, there is an unexpected development exception");
225+
//Any unexpected errors that the decoder did not protect against.
226+
Console.WriteLine("Oops, there is an unexpected development exception.");
211227
Console.WriteLine(Exception.Message);
212228
}
213229
}
@@ -255,7 +271,6 @@ namespace SHC.DecoderDemo
255271
}
256272
}
257273
}
258-
259274
```
260275

261276

0 commit comments

Comments
 (0)