LensHttpStatus(int statusCode, String reasonPhrase) { this.statusCode = statusCode; this.reasonPhrase = reasonPhrase; this.family = LensHttpStatus.familyOf(statusCode); }
public String getFormattedErrorMsg(LensError lensError) { return lensError.getFormattedErrorMsg(errorMsgFormattingArgs); }
private void initializeErrorCollection() { try { errorCollection = new ErrorCollectionFactory().createErrorCollection(); } catch (ClassNotFoundException e) { throw new RuntimeException("Could not create error collection.", e); } }
static PruneCauses.BriefAndDetailedError extractPruneCause(LensException e) throws ClassNotFoundException { try { ErrorCollection errorCollection = new ErrorCollectionFactory().createErrorCollection(); final LensError lensError = errorCollection.getLensError(e.getErrorCode()); return new ObjectMapper().readValue( e.getFormattedErrorMsg(lensError).substring(e.getFormattedErrorMsg(lensError) .indexOf("{"), e.getFormattedErrorMsg(lensError).length()), new TypeReference<PruneCauses.BriefAndDetailedError>() {}); } catch (IOException e1) { throw new RuntimeException("!!!"); } }
public PrivilegeException(String resourceType, String resourceIdentifier, String privilege) { super( new LensErrorInfo(NOT_AUTHORIZED.getValue(), 0, NOT_AUTHORIZED.toString()) , privilege , resourceType , resourceIdentifier); this.resourceType = resourceType; this.resourceIdentifier = resourceIdentifier; this.privilege = privilege; } }
public final void buildLensErrorResponse(final ErrorCollection errorCollection, final String apiVersion, final String id) { final LensError lensError = errorCollection.getLensError(getErrorCode()); final LensErrorTO lensErrorTO = buildLensErrorTO(errorCollection, lensError); lensAPIResult = LensAPIResult.composedOf(apiVersion, id, lensErrorTO, lensError.getHttpStatusCode()); }
public final LensErrorTO buildLensErrorTO(final ErrorCollection errorCollection) { final LensError lensError = errorCollection.getLensError(getErrorCode()); return buildLensErrorTO(errorCollection, lensError); }
@Override public ImmutableSet<Class> getErrorPayloadClasses() { return ImmutableSet.copyOf(getErrorPayloadClassesList()); }
public static Response.StatusType fromStatusCode(int statusCode) { // Delegate all status code calls to Response.Status. // Compute status code from LensHttpStatus only if it does not get status code from Status. Response.StatusType httpStatusCode = Response.Status.fromStatusCode(statusCode); if (httpStatusCode == null) { LensHttpStatus[] arr = values(); int len = arr.length; for (int i = 0; i < len; ++i) { LensHttpStatus lensHttpStatus = arr[i]; if (lensHttpStatus.statusCode == statusCode) { return lensHttpStatus; } } } return httpStatusCode; }
public PrivilegeException(String resourceType, String resourceIdentifier, String privilege) { super( new LensErrorInfo(NOT_AUTHORIZED.getValue(), 0, NOT_AUTHORIZED.toString()) , privilege , resourceType , resourceIdentifier); this.resourceType = resourceType; this.resourceIdentifier = resourceIdentifier; this.privilege = privilege; } }
public String getFormattedErrorMsg(LensError lensError) { return lensError.getFormattedErrorMsg(errorMsgFormattingArgs); }
public final void buildLensErrorResponse(final ErrorCollection errorCollection, final String apiVersion, final String id) { final LensError lensError = errorCollection.getLensError(getErrorCode()); final LensErrorTO lensErrorTO = buildLensErrorTO(errorCollection, lensError); lensAPIResult = LensAPIResult.composedOf(apiVersion, id, lensErrorTO, lensError.getHttpStatusCode()); }
public final LensErrorTO buildLensErrorTO(final ErrorCollection errorCollection) { final LensError lensError = errorCollection.getLensError(getErrorCode()); return buildLensErrorTO(errorCollection, lensError); }
LensHttpStatus(int statusCode, String reasonPhrase) { this.statusCode = statusCode; this.reasonPhrase = reasonPhrase; this.family = LensHttpStatus.familyOf(statusCode); }
@Override public ImmutableSet<Class> getErrorPayloadClasses() { return ImmutableSet.copyOf(getErrorPayloadClassesList()); }
@Override public String getFormattedErrorMsg(LensError lensError) { final String conflictingFieldsStr = conflictingFields.getConflictingFieldsString(); return lensError.getFormattedErrorMsg(conflictingFieldsStr); }
@Override public String getFormattedErrorMsg(LensError lensError) { final String supportedOpsStr = supportedOps.getSupportedOperationsAsString(); return lensError.getFormattedErrorMsg(supportedOpsStr); }
@Override public String getFormattedErrorMsg(LensError lensError) { final String conflictingFieldsStr = conflictingFields.getConflictingFieldsString(); return lensError.getFormattedErrorMsg(conflictingFieldsStr); }
@Override public String getFormattedErrorMsg(LensError lensError) { final String colName = colUnAvailableInTimeRange.getColumnName(); final String availability = colUnAvailableInTimeRange.getAvailability(); return lensError.getFormattedErrorMsg(colName, availability); }
@Override public String getFormattedErrorMsg(LensError lensError) { final String colName = colUnAvailableInTimeRange.getColumnName(); final String availability = colUnAvailableInTimeRange.getAvailability(); return lensError.getFormattedErrorMsg(colName, availability); }