/*
 *  Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package org.wso2.carbon.identity.oauth.dcr.exception;

import org.wso2.carbon.identity.base.IdentityException;

/**
 * Used to create checked exceptions that can be handled.
 */
public class DCRMException extends IdentityException {

    private static final long serialVersionUID = 3410706411312659760L;

    public DCRMException(String message) {

        super(message);
        this.setErrorCode(getDefaultErrorCode());
    }

    public DCRMException(String message, Throwable cause) {

        super(message, cause);
        this.setErrorCode(getDefaultErrorCode());
    }

    public DCRMException(String errorCode, String message) {

        super(errorCode, message);
        this.setErrorCode(errorCode);
    }

    public DCRMException(String errorCode, String message, Throwable throwable) {

        super(errorCode, message, throwable);
        this.setErrorCode(errorCode);
    }

    public String getErrorDescription() {

        String errorDescription = this.getMessage();
//        if (StringUtils.isEmpty(errorDescription)) {
//            TODO define error codes for DCRM
//            errorDescription = Oauth2ScopeConstants.ErrorMessages.ERROR_CODE_UNEXPECTED.getMessage();
//        }
        return errorDescription;
    }

    private String getDefaultErrorCode() {

        String errorCode = super.getErrorCode();
//        if (StringUtils.isEmpty(errorCode)) {
//            TODO define error codes for DCRM
//            errorCode = Oauth2ScopeConstants.ErrorMessages.ERROR_CODE_UNEXPECTED.getCode();
//        }
        return errorCode;
    }

}

@@ -1592,302 +1592,32 @@
     
-String errorDescription = this.getMessage();%0A//        if (StringUtils.isEmpty(errorDescription)) %7B%0A//            TODO define error codes for DCRM%0A//            errorDescription = Oauth2ScopeConstants.ErrorMessages.ERROR_CODE_UNEXPECTED.getMessage();%0A//        %7D%0A        return errorDescription
+return this.getMessage()
 ;%0A  
@@ -1677,26 +1677,14 @@
     
-String errorCode =
+return
  sup
@@ -1706,240 +1706,12 @@
 ();%0A
-//        if (StringUtils.isEmpty(errorCode)) %7B%0A//            TODO define error codes for DCRM%0A//            errorCode = Oauth2ScopeConstants.ErrorMessages.ERROR_CODE_UNEXPECTED.getCode();%0A//        %7D%0A        return errorCode;%0A    %7D%0A
+    %7D
 %0A%7D%0A

Remove commented code