/*
 * Copyright (c) 2013 NEC Corporation
 * All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this
 * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
 */

package org.opendaylight.vtn.manager;

import org.opendaylight.controller.sal.utils.Status;
import org.opendaylight.controller.sal.utils.StatusCode;

/**
 * The {@code VTNException} class is an exception thrown by VTN Manager API.
 *
 * <p>
 *   This exception is used to throw a failure status as an exception.
 * </p>
 */
public class VTNException extends Exception {
    /**
     * Version number for serialization.
     */
    private static final long serialVersionUID = -6977947338362700417L;

    /**
     * Operation status.
     */
    private final Status  status;

    /**
     * Construct a VTN manager exception.
     *
     * @param status   A status to be delivered as exception.
     */
    public VTNException(Status status) {
        super((status == null) ? null : status.toString());
        this.status = status;
    }

    /**
     * Construct a VTN exception.
     *
     * @param code  The status code.
     * @param desc  Description about the status.
     */
    public VTNException(StatusCode code, String desc) {
        super(desc);
        this.status = new Status(code, desc);
    }

    /**
     * Construct a new VTN exception which represents an error caused by
     * unexpected exception.
     *
     * @param message  The detailed message.
     * @param cause    The cause of an error.
     */
    public VTNException(String message, Throwable cause) {
        super(message, cause);
        this.status = new Status(StatusCode.INTERNALERROR, message);
    }

    /**
     * Get status which indicates the cause of error.
     *
     * @return A status.
     */
    public Status getStatus() {
        return status;
    }
}

@@ -769,27 +769,27 @@
  = -
-6977947338362700417
+3983343760793384085
 L;%0A%0A
@@ -1121,32 +1121,398 @@
  status;%0A    %7D%0A%0A
+    /**%0A     * Consturct a VTN exception with SAL status and cause of exception.%0A     *%0A     * @param status   A status to be delivered as exception.%0A     * @param cause    The cause of an error.%0A     */%0A    public VTNException(Status status, Throwable cause) %7B%0A        super((status == null) ? null : status.toString(), cause);%0A        this.status = status;%0A    %7D%0A%0A
     /**%0A     * C
@@ -1699,29 +1699,8 @@
 ) %7B%0A
-        super(desc);%0A
     
@@ -1703,34 +1703,25 @@
         this
-.status = 
+(
 new Status(c
@@ -1730,16 +1730,17 @@
 e, desc)
+)
 ;%0A    %7D%0A
@@ -2019,39 +2019,8 @@
 ) %7B%0A
-        super(message, cause);%0A
     
@@ -2027,26 +2027,17 @@
     this
-.status = 
+(
 new Stat
@@ -2073,16 +2073,24 @@
 message)
+, cause)
 ;%0A    %7D%0A

Use string representation of SAL status as exception's message.