001// Licensed under the Apache License, Version 2.0 (the "License"); 002// you may not use this file except in compliance with the License. 003// You may obtain a copy of the License at 004// 005// http://www.apache.org/licenses/LICENSE-2.0 006// 007// Unless required by applicable law or agreed to in writing, software 008// distributed under the License is distributed on an "AS IS" BASIS, 009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 010// See the License for the specific language governing permissions and 011// limitations under the License. 012package org.apache.tapestry5.services; 013 014import org.apache.tapestry5.ioc.Resource; 015 016/** 017 * Class that represents the exception of an asset not being found. 018 */ 019public class AssetNotFoundException extends RuntimeException { 020 021 private static final long serialVersionUID = 1L; 022 023 final private Resource resource; 024 025 /** 026 * {@inheritDoc} 027 */ 028 public AssetNotFoundException(String message) { 029 super(message); 030 resource = null; 031 } 032 033 /** 034 * Constructs an exception with message and a {@link Resource}. 035 * @param message a <code>String</code>. 036 * @param resource a {@link Resource}. 037 */ 038 public AssetNotFoundException(String message, Resource resource) { 039 super(message); 040 this.resource = resource; 041 } 042 043 /** 044 * The resource which wasn't found. It may be null. 045 * @return a {@link Resource}. 046 */ 047 public Resource getResource() { 048 return resource; 049 } 050 051}