blob: 055f0125a5acf1b1bcee37699cb0133f5b62a909 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2014-present Open Networking Laboratory
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07003 *
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 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.intent.impl;
Brian O'Connor66630c82014-10-02 21:08:19 -070017
Sho SHIMIZU877ec2c2015-02-09 12:50:36 -080018import com.google.common.base.MoreObjects;
19import org.onosproject.net.ElementId;
Brian O'Connorabafb502014-12-02 22:26:20 -080020import org.onosproject.net.intent.IntentException;
Brian O'Connor66630c82014-10-02 21:08:19 -070021
Sho SHIMIZU877ec2c2015-02-09 12:50:36 -080022import static com.google.common.base.Preconditions.checkNotNull;
23
Brian O'Connor66630c82014-10-02 21:08:19 -070024/**
25 * An exception thrown when a path is not found.
26 */
27public class PathNotFoundException extends IntentException {
28 private static final long serialVersionUID = -2087045731049914733L;
29
Sho SHIMIZU877ec2c2015-02-09 12:50:36 -080030 private final ElementId source;
31 private final ElementId destination;
32
33 public PathNotFoundException(ElementId source, ElementId destination) {
34 super(String.format("No path from %s to %s", source, destination));
35 this.source = checkNotNull(source);
36 this.destination = checkNotNull(destination);
Brian O'Connor66630c82014-10-02 21:08:19 -070037 }
38
Sho SHIMIZU877ec2c2015-02-09 12:50:36 -080039 @Override
40 public String toString() {
41 return MoreObjects.toStringHelper(this)
42 .add("source", source)
43 .add("destination", destination)
44 .toString();
Brian O'Connor66630c82014-10-02 21:08:19 -070045 }
46}