make base class for bencode related errors
This commit is contained in:
parent
d67a603039
commit
f5ab05acdc
4 changed files with 27 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
package com.mykola2312.retracker.bencode.error;
|
||||
|
||||
public class BDecodeError extends Exception {
|
||||
public class BDecodeError extends BError {
|
||||
private static final long serialVersionUID = 4282658520481186036L;
|
||||
|
||||
public byte[] data;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package com.mykola2312.retracker.bencode.error;
|
||||
|
||||
/* A base type, all bencode related errors are
|
||||
* derived from this class for easy try-catching
|
||||
*/
|
||||
public class BError extends Exception {
|
||||
private static final long serialVersionUID = 1626675512183720021L;
|
||||
|
||||
public BError(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public BError(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.mykola2312.retracker.bencode.error;
|
||||
|
||||
public class BErrorNoRoot extends BError {
|
||||
private static final long serialVersionUID = -7691652539624483490L;
|
||||
|
||||
public BErrorNoRoot() {
|
||||
super("BTree has no root");
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@ package com.mykola2312.retracker.bencode.error;
|
|||
|
||||
import com.mykola2312.retracker.bencode.BValue;
|
||||
|
||||
public class BValueError extends Exception {
|
||||
public class BValueError extends BError {
|
||||
private static final long serialVersionUID = 6950892783320917930L;
|
||||
|
||||
public BValue node;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue