1 /*
2 * Copyright 2012-2025 CodeLibs Project and the Others.
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,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16 package org.codelibs.fess.exception;
17
18 import org.codelibs.fess.mylasta.action.FessMessages;
19 import org.lastaflute.web.validation.VaMessenger;
20
21 /**
22 * Exception thrown when an invalid query is encountered.
23 * This exception is typically used in search contexts where a provided
24 * query is malformed, contains invalid syntax, or violates query constraints.
25 */
26 public class InvalidQueryException extends FessSystemException {
27
28 /** Serial version UID for serialization */
29 private static final long serialVersionUID = 1L;
30
31 /** Message code for localized error messages */
32 private final transient VaMessenger<FessMessages> messageCode;
33
34 /**
35 * Creates a new InvalidQueryException with message code, message, and cause.
36 *
37 * @param messageCode the message code for localized error messages
38 * @param message the detailed error message
39 * @param cause the cause of the exception
40 */
41 public InvalidQueryException(final VaMessenger<FessMessages> messageCode, final String message, final Throwable cause) {
42 super(message, cause);
43 this.messageCode = messageCode;
44 }
45
46 /**
47 * Creates a new InvalidQueryException with message code and message.
48 *
49 * @param messageCode the message code for localized error messages
50 * @param message the detailed error message
51 */
52 public InvalidQueryException(final VaMessenger<FessMessages> messageCode, final String message) {
53 super(message);
54 this.messageCode = messageCode;
55 }
56
57 /**
58 * Returns the message code for localized error messages.
59 *
60 * @return the message code
61 */
62 public VaMessenger<FessMessages> getMessageCode() {
63 return messageCode;
64 }
65
66 }