001/*
002 * Copyright 2022-2025 Revetware LLC.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package com.soklet.exception;
018
019import com.soklet.core.MultipartField;
020
021import javax.annotation.Nonnull;
022import javax.annotation.Nullable;
023import javax.annotation.concurrent.NotThreadSafe;
024
025import static java.util.Objects.requireNonNull;
026
027/**
028 * @author <a href="https://www.revetkn.com">Mark Allen</a>
029 */
030@NotThreadSafe
031public class IllegalMultipartFieldException extends BadRequestException {
032        @Nonnull
033        private final MultipartField multipartField;
034
035        public IllegalMultipartFieldException(@Nullable String message,
036                                                                                                                                                                @Nonnull MultipartField multipartField) {
037                super(message);
038                this.multipartField = requireNonNull(multipartField);
039        }
040
041        public IllegalMultipartFieldException(@Nullable String message,
042                                                                                                                                                                @Nullable Throwable cause,
043                                                                                                                                                                @Nonnull MultipartField multipartField) {
044                super(message, cause);
045                this.multipartField = requireNonNull(multipartField);
046        }
047
048        @Nonnull
049        public MultipartField getMultipartField() {
050                return this.multipartField;
051        }
052}