Remodel the Model
- The configuration and crypto model is now entirely independent of Android classes other than Nullable and TextUtils. - Model classes are immutable and use builders that enforce the appropriate optional/required attributes. - The Android config proxies (for Parcelable and databinding) are moved to the Android side of the codebase, and are designed to be safe for two-way databinding. This allows proper observability in TunnelDetailFragment. - Various robustness fixes and documentation updates to helper classes. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
committed by
Jason A. Donenfeld
parent
a264f7ab36
commit
d1e85633fb
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright © 2018 WireGuard LLC. All Rights Reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.wireguard.config;
|
||||
|
||||
/**
|
||||
* An exception representing a failure to parse an element of a WireGuard configuration. The context
|
||||
* for this failure can be retrieved with {@link #getContext}, and the text that failed to parse can
|
||||
* be retrieved with {@link #getText}.
|
||||
*/
|
||||
public class ParseException extends Exception {
|
||||
private final String context;
|
||||
private final CharSequence text;
|
||||
|
||||
public ParseException(final String context, final CharSequence text, final String message) {
|
||||
super(message);
|
||||
this.context = context;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public ParseException(final String context, final CharSequence text, final Throwable cause) {
|
||||
super(cause.getMessage(), cause);
|
||||
this.context = context;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public ParseException(final String context, final CharSequence text) {
|
||||
this.context = context;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public CharSequence getText() {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user