All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.trimble.id.TCPServiceException Maven / Gradle / Ivy

Go to download

Trimble Identity OAuth Client library holds the client classes that are used for communicating with Trimble Identity Service

The newest version!
package com.trimble.id;

import java.util.concurrent.CompletionException;

/**
 * TCPException is a custom exception class that extends
 * CompletionException.
 */
public class TCPServiceException extends CompletionException {

    private static final long serialVersionUID = 1L;

    private final String requestId;
    private final int statusCode;

    /**
     * Constructor for TCPException.
     * 
     * @param exception  - the exception
     * @param requestId  - the request id
     * @param statusCode - the status code
     */
    public TCPServiceException(Exception exception, String requestId, int statusCode) {
        super(exception);
        this.requestId = requestId;
        this.statusCode = statusCode;
    }

    /**
     * Constructor for TCPException.
     * 
     * @param message    - the exception message
     * @param requestId  - the request id
     * @param statusCode - the status code
     */
    public TCPServiceException(String message, String requestId, int statusCode) {
        super(message);
        this.requestId = requestId;
        this.statusCode = statusCode;
    }

    /**
     * Constructor for TCPException.
     * 
     * @param exception - the exception
     */
    public TCPServiceException(Exception exception) {
        super(exception);
        this.requestId = null;
        this.statusCode = 0;
    }

    /**
     * Constructor for TCPException.
     * 
     * @param message - the exception message
     */
    public TCPServiceException(String message) {
        super(message);
        this.requestId = null;
        this.statusCode = 0;
    }

    /**
     * Get the request id.
     * 
     * @return the request id
     */
    public String getRequestId() {
        return requestId;
    }

    /**
     * Get the status code.
     * 
     * @return the status code
     */
    public int getStatusCode() {
        return statusCode;
    }

    @Override
    public String toString() {
        String message = getMessage();
        return "TCPServiceException(" +
                (message != null ? "message=" + message : "") +
                (requestId != null ? ",requestId=" + requestId : "") +
                (statusCode != 0 ? ",statusCode=" + statusCode : "") + ")";
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy