5656import static org .wso2 .carbon .identity .api .server .vc .template .management .common .VCTemplateManagementConstants .DESC_SORT_ORDER ;
5757import static org .wso2 .carbon .identity .api .server .vc .template .management .common .VCTemplateManagementConstants .PATH_SEPARATOR ;
5858import static org .wso2 .carbon .identity .api .server .vc .template .management .common .VCTemplateManagementConstants .VC_TEMPLATE_PATH_COMPONENT ;
59- import static org .wso2 .carbon .identity .openid4vc .template .management .constant .VCTemplateManagementConstants .ErrorMessages .ERROR_CODE_INVALID_CLAIM ;
6059import static org .wso2 .carbon .identity .openid4vc .template .management .constant .VCTemplateManagementConstants .ErrorMessages .ERROR_CODE_INVALID_QUERY_PARAM ;
6160
6261/**
@@ -367,14 +366,14 @@ private APIError handleVCTemplateException(VCTemplateMgtException exception) {
367366
368367 if (exception instanceof VCTemplateMgtClientException ) {
369368 errorResponse = new ErrorResponse .Builder ()
370- .withCode (prefixCode ( exception .getErrorCode () ))
369+ .withCode (exception .getErrorCode ())
371370 .withMessage (exception .getMessage ())
372371 .withDescription (exception .getDescription ())
373372 .build (LOG , exception .getDescription ());
374373 status = getClientErrorStatus (exception .getErrorCode ());
375374 } else if (exception instanceof VCTemplateMgtServerException ) {
376375 errorResponse = new ErrorResponse .Builder ()
377- .withCode (prefixCode ( exception .getErrorCode () ))
376+ .withCode (exception .getErrorCode ())
378377 .withMessage (exception .getMessage ())
379378 .withDescription (exception .getDescription ())
380379 .build (LOG , exception .getDescription ());
@@ -404,17 +403,6 @@ private Response.Status getClientErrorStatus(String errorCode) {
404403 return Response .Status .BAD_REQUEST ;
405404 }
406405
407- private String prefixCode (String code ) {
408-
409- if (StringUtils .isBlank (code )) {
410- return "VC-00000" ;
411- }
412- if (code .contains (Constants .ERROR_CODE_DELIMITER )) {
413- return code ;
414- }
415- return "VC-" + code ;
416- }
417-
418406 private String includeData (String message , String data ) {
419407
420408 if (StringUtils .isNotBlank (data )) {
@@ -441,7 +429,8 @@ private Integer validatedLimit(Integer limit) {
441429 limit = limit == null ? DEFAULT_LIMIT : limit ;
442430 if (limit <= 0 ) {
443431 throw handleVCTemplateException (
444- VCTemplateMgtExceptionHandler .handleClientException (ERROR_CODE_INVALID_CLAIM , limit .toString ()));
432+ VCTemplateMgtExceptionHandler .handleClientException (ERROR_CODE_INVALID_QUERY_PARAM ,
433+ limit .toString ()));
445434 }
446435 return limit ;
447436 }
0 commit comments