@Override protected ServiceException mapDescriptorToState(HttpException e, ErrorDescriptor descriptor) { if (descriptor .getErrorCodes() .contains("report.options.exception.label.exists.another.report")) { return new ServiceException( "A Saved Options with that name already exists in this folder, under another report", e, StatusCodes.SAVED_VALUES_EXIST_IN_FOLDER); } else if (descriptor.getErrorCodes().contains("report.options.error.too.long.label")) { List<String> paramsList = new ArrayList<>(descriptor.getParameters()); String errorArgument = paramsList.size() > 0 ? paramsList.get(0) : ""; ServiceException exception = new ServiceException( "The Saved Options label is too long. The maximum length is " + errorArgument + " characters", e, StatusCodes.SAVED_VALUES_LABEL_TOO_LONG); exception.setArguments(paramsList); return exception; } return mDelegate.transform(e); }