Excited to tell you that our welfare activity has been upgraded - Paying only $5.00 + Freight to get JCOP J3H145 card and A40CR card.
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 :46
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 0 guests

JavaCard OS : Disclaimer