View Javadoc
1   /*
2   * Copyright 2020-2026 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.bremersee.minio;
18  
19  import java.io.Serial;
20  import lombok.EqualsAndHashCode;
21  import org.bremersee.exception.AbstractServiceExceptionBuilder;
22  import org.bremersee.exception.ErrorCodeAware;
23  import org.bremersee.exception.HttpStatusAware;
24  import org.bremersee.exception.ServiceException;
25  import org.bremersee.exception.ServiceExceptionBuilder;
26  
27  /**
28   * The minio exception.
29   *
30   * @author Christian Bremer
31   */
32  @EqualsAndHashCode(callSuper = true)
33  public class MinioException extends ServiceException implements HttpStatusAware, ErrorCodeAware {
34  
35    @Serial
36    private static final long serialVersionUID = 1L;
37  
38    /**
39     * Instantiates a new minio exception.
40     *
41     * @param httpStatus the http status
42     * @param errorCode the error code
43     * @param reason the reason
44     * @param cause the cause
45     */
46    protected MinioException(
47        final int httpStatus,
48        final String errorCode,
49        final String reason,
50        final Throwable cause) {
51      super(httpStatus, errorCode, reason, cause);
52    }
53  
54    /**
55     * Creates new exception builder.
56     *
57     * @return the builder
58     */
59    public static ServiceExceptionBuilder<? extends MinioException> builder() {
60  
61      return new AbstractServiceExceptionBuilder<>() {
62  
63        @Serial
64        private static final long serialVersionUID = 2L;
65  
66        @Override
67        protected MinioException buildWith(
68            int httpStatus,
69            String errorCode,
70            String reason,
71            Throwable cause) {
72          return new MinioException(httpStatus, errorCode, reason, cause);
73        }
74      };
75    }
76  
77  }