Take a survey

Developing Components > Creating Components That Use Custom Data Types > Creating your application logic > Creating user-defined exceptions

Creating user-defined exceptions
Creating user-defined exceptions is a way of distinguishing exceptions thrown by your own services. It is optional because you can rely on the built-in java.lang.Exception object to be thrown from your methods. The bank component created in this section uses two user-defined exceptions:
CustomerException is located in the com.adobe.livecycle.sample.customer package.
AccountException is located in the com.adobe.livecycle.sample.account package.
The following Java code creates the CustomerException.
Example: Creating CustomerException
package com.adobe.livecycle.sample.customer;
 
/**
 * CustomerException throws Customer service specific exceptions.
 *
 */
public class CustomerException extends Exception {
    //Constructor
    public CustomerException() {
        super();
    }
 
    public CustomerException(String message){
        super(message);
    }
}
The following Java code creates the AccountException.
Example: Creating AccountException
package com.adobe.livecycle.sample.account;
 
/**
 * AccountException throws Account service specific exceptions.
 *
 */
public class AccountException extends Exception {
    //Constructor
    public AccountException() {
        super();
    }
 
    public AccountException(String message){
        super(message);
    }
}

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/componentCreatingMultiple.159.9.html