Jonathan Hart | 6df9017 | 2014-04-03 10:13:11 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.datastore; |
Yuta HIGUCHI | 66ca1bf | 2014-03-12 18:34:09 -0700 | [diff] [blame] | 2 | |
Jonathan Hart | 6df9017 | 2014-04-03 10:13:11 -0700 | [diff] [blame] | 3 | import net.onrc.onos.core.datastore.utils.ByteArrayUtil; |
Yuta HIGUCHI | 66ca1bf | 2014-03-12 18:34:09 -0700 | [diff] [blame] | 4 | |
| 5 | /** |
| 6 | * Exception thrown when object was expected, but not found in data store. |
| 7 | */ |
| 8 | public class ObjectDoesntExistException extends RejectRulesException { |
| 9 | private static final long serialVersionUID = 859082748533417866L; |
| 10 | |
| 11 | public ObjectDoesntExistException(final String message) { |
Yuta HIGUCHI | 826b4a4 | 2014-03-24 13:10:33 -0700 | [diff] [blame] | 12 | super(message); |
Yuta HIGUCHI | 66ca1bf | 2014-03-12 18:34:09 -0700 | [diff] [blame] | 13 | } |
| 14 | |
| 15 | public ObjectDoesntExistException(final IKVTableID tableID, |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 16 | final byte[] key, final Throwable cause) { |
Yuta HIGUCHI | 805bc8f | 2014-04-16 11:51:43 -0700 | [diff] [blame] | 17 | super(ByteArrayUtil.toHexStringBuilder(key, ":") |
Yuta HIGUCHI | 826b4a4 | 2014-03-24 13:10:33 -0700 | [diff] [blame] | 18 | + " did not exist on table:" + tableID, cause); |
Yuta HIGUCHI | 66ca1bf | 2014-03-12 18:34:09 -0700 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | public ObjectDoesntExistException(final IKVTableID tableID, final byte[] key) { |
Yuta HIGUCHI | 805bc8f | 2014-04-16 11:51:43 -0700 | [diff] [blame] | 22 | super(ByteArrayUtil.toHexStringBuilder(key, ":") |
Yuta HIGUCHI | 826b4a4 | 2014-03-24 13:10:33 -0700 | [diff] [blame] | 23 | + " did not exist on table:" + tableID); |
Yuta HIGUCHI | 66ca1bf | 2014-03-12 18:34:09 -0700 | [diff] [blame] | 24 | } |
| 25 | } |