001/*
002 * Copyright 2002-2012 the original author or authors.
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 *      https://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 org.springframework.scheduling.quartz;
018
019import org.springframework.core.NestedRuntimeException;
020import org.springframework.util.MethodInvoker;
021
022/**
023 * Unchecked exception that wraps an exception thrown from a target method.
024 * Propagated to the Quartz scheduler from a Job that reflectively invokes
025 * an arbitrary target method.
026 *
027 * @author Juergen Hoeller
028 * @since 2.5.3
029 * @see MethodInvokingJobDetailFactoryBean
030 */
031@SuppressWarnings("serial")
032public class JobMethodInvocationFailedException extends NestedRuntimeException {
033
034        /**
035         * Constructor for JobMethodInvocationFailedException.
036         * @param methodInvoker the MethodInvoker used for reflective invocation
037         * @param cause the root cause (as thrown from the target method)
038         */
039        public JobMethodInvocationFailedException(MethodInvoker methodInvoker, Throwable cause) {
040                super("Invocation of method '" + methodInvoker.getTargetMethod() +
041                                "' on target class [" + methodInvoker.getTargetClass() + "] failed", cause);
042        }
043
044}