All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.client.ErrorResponseException Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show newest version
package io.sphere.sdk.client;

import io.sphere.sdk.models.errors.ErrorResponse;
import io.sphere.sdk.models.errors.SphereError;

import java.util.Collections;
import java.util.List;

/**

 

Error Codes

InvalidField

One possible cause could be, that you try to set the value of a product attribute and the type is not matching or you have an enum field and the key is wrong.

Example: {"statusCode":400,"message":"The value '2' is not valid for field 'fieldNameExample'. Allowed values are: \"red\",\"green\". ","errors":[{"code":"InvalidField","message":"The value '2' is not valid for field 'fieldNameExample'. Allowed values are: \"red\",\"green\". ","invalidValue":2,"allowedValues":["red","green"],"field":"fieldNameExample"}]} */ public class ErrorResponseException extends BadRequestException implements ErrorResponse { private static final long serialVersionUID = 0L; private final Integer statusCode; private final String message; private final List errors; public ErrorResponseException(final ErrorResponse errorResponse) { this(errorResponse.getStatusCode(), errorResponse.getMessage(), errorResponse.getErrors()); } ErrorResponseException(final Integer statusCode, final String message, final List errors) { this.statusCode = statusCode; this.message = message; this.errors = errors == null ? Collections.emptyList() : errors; } @Override public Integer getStatusCode() { return statusCode; } @Override public List getErrors() { return errors; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy