Open Kilda Java Documentation
ErrorType.java
Go to the documentation of this file.
1 /* Copyright 2017 Telstra Open Source
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package org.openkilda.messaging.error;
17 
18 import com.fasterxml.jackson.annotation.JsonCreator;
19 import com.fasterxml.jackson.annotation.JsonInclude;
20 import com.fasterxml.jackson.annotation.JsonProperty;
21 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
22 
26 @JsonSerialize
27 @JsonInclude(JsonInclude.Include.NON_NULL)
28 public enum ErrorType {
32  INTERNAL_ERROR("Internal service error"),
33 
37  CREATION_FAILURE("Flow creation error"),
38 
42  UPDATE_FAILURE("Flow update error"),
43 
47  DELETION_FAILURE("Flow deletion error"),
48 
52  NOT_IMPLEMENTED("Feature not implemented"),
53 
57  NOT_FOUND("Object was not found"),
58 
62  ALREADY_EXISTS("Object already exists"),
63 
67  DATA_INVALID("Invalid request data"),
68 
72  PARAMETERS_INVALID("Invalid request parameters"),
73 
77  REQUEST_INVALID("Invalid request"),
78 
82  OPERATION_TIMED_OUT("Operation has timed out"),
83 
87  AUTH_FAILED("Invalid credentials");
88 
92  @JsonProperty("error-type")
93  private final String errorType;
94 
100  @JsonCreator
101  ErrorType(@JsonProperty("error-type") final String errorType) {
102  this.errorType = errorType;
103  }
104 
108  @Override
109  public String toString() {
110  return errorType;
111  }
112 }