Skip to content

Commit 63c4f00

Browse files
committed
Update the demo program to show the use of the new exception types
1 parent 1cf20ae commit 63c4f00

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

SmartHealthCard.DecoderDemo/Program.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,28 @@ static async Task DecoderDemoRunner()
5757
}
5858
catch (SmartHealthCardSignatureInvalidException SignatureInvalidException)
5959
{
60-
Console.WriteLine("The SMART Health Card is invalid");
60+
//The decoder successfully validated the JWS signature and found it to be invalid
61+
Console.WriteLine("The SMART Health Card's signing signature is invalid");
6162
Console.WriteLine(SignatureInvalidException.Message);
6263
}
64+
catch (SmartHealthCardJwksRequestException JwksRequestException)
65+
{
66+
//The decoder was unable to retrieved JWKS file that contains the token's public signing key.
67+
//This is likely due to an Internet connectivity issue, the exception message will say more.
68+
Console.WriteLine("The SMART Health Card's public key can not be retrieved.");
69+
Console.WriteLine(JwksRequestException.Message);
70+
}
6371
catch (SmartHealthCardDecoderException DecoderException)
6472
{
65-
Console.WriteLine("The SMART Health Card Decoder has found an error, please see message below::");
73+
//The decoder ran into an error while attempting to decode the JWS token and its SMART Health card payload.
74+
//It is likely that the SMART Health card token is incorrectly structured
75+
Console.WriteLine("The SMART Health Card Decoder has encountered an error, please see message below::");
6676
Console.WriteLine(DecoderException.Message);
6777
}
6878
catch (Exception Exception)
6979
{
70-
Console.WriteLine("Oops, there is an unexpected development exception");
80+
//Any unexpected errors that the decoder did not protect against.
81+
Console.WriteLine("Oops, there is an unexpected development exception.");
7182
Console.WriteLine(Exception.Message);
7283
}
7384
}

0 commit comments

Comments
 (0)