2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.bgp.parser;
10 import org.slf4j.Logger;
11 import org.slf4j.LoggerFactory;
13 import org.opendaylight.protocol.framework.DocumentedException;
16 * There are several errors documented in RFC4271 or in draft, that have specific meaning for the BGP. This exception is
17 * used, when any of those errors occurs.
19 public final class BGPDocumentedException extends DocumentedException {
21 private static final long serialVersionUID = -6212702584439430736L;
23 private static final Logger logger = LoggerFactory.getLogger(BGPDocumentedException.class);
25 private final BGPError error;
27 private final byte[] data;
30 * Used when an error occurred that is described in rfc or draft.
32 * @param message message bound with this exception
33 * @param error specific documented error
35 public BGPDocumentedException(final String message, final BGPError error) {
36 this(message, error, null);
40 * Used when an error occurred that is described in rfc or draft.
42 * @param message message bound with this exception
43 * @param error specific documented error
44 * @param data data associated with the error
46 public BGPDocumentedException(final String message, final BGPError error, final byte[] data) {
50 logger.error("Error = " + error, this);
54 * Returns specific documented error.
56 * @return documented error
58 public BGPError getError() {
63 * Returns data associated with this error.
65 * @return byte array data
67 public byte[] getData() {