In order to thank you for all members' support of our website, we are holding new events - Getting Free Samples by Paying Freight only.
Want to get free samples? Please check this post for more details.

How to throw an exception in my applet

Applets Development Guide

Moderator: product

CarCard
Posts: 1
Joined: Thu May 10, 2018 5:30 am
Points :14
Contact:

How to throw an exception in my applet

Post by CarCard » Thu May 10, 2018 5:35 am

Hi, everyone

I'm learning to write Java Card Applet.

I want to throw an exception when the program execution error occurs, How to write the code in my applet?

Can anyone help me?

Garfield
Posts: 2
Joined: Thu Sep 22, 2016 4:15 am
Points :42
Contact:

Re: How to throw an exception in my applet

Post by Garfield » Tue Jun 12, 2018 3:10 am

There is a special function for exception handling in class "ISOException":
public static void throwIt(short sw)
{}
you could use it.
Firstly, you need to import the class "ISOException" in your Applet by using the command below:
"import javacard.framework.ISOException;"
next step, call the function when you need,such as:
if(condition == false)
{
ISOException.throwIt((short)0x6F00);
}

Hope it helps you.

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 1 guest

JavaCard OS : Disclaimer