Commit 798ccf6f authored by R.W.Majeed's avatar R.W.Majeed

Common constructors for ObservationException

parent 9c4ba8fb
......@@ -32,14 +32,29 @@ public class ObservationException extends Exception{
private Observation fact;
public ObservationException(Throwable cause){
super(cause);
}
public ObservationException(String message, Throwable cause) {
super(message, cause);
}
@Deprecated
public ObservationException(Observation fact, Throwable cause){
super(cause);
this.fact = fact;
}
@Deprecated
public ObservationException(String message, Observation fact, Throwable cause){
super(message, cause);
this.fact = fact;
}
/**
* Set the observation associated with this exception
* @param fact associated observation
*/
public void setObservation(Observation fact){
this.fact = fact;
}
/**
* Get the observation associated with this exception.
* @return associated observation or null if none.
......
......@@ -35,6 +35,7 @@ public abstract class AbstractObservationHandler implements ObservationHandler{
try {
acceptOrException(observation);
} catch (ObservationException e) {
e.setObservation(observation);
reportError(e);
} // don't catch runtime exceptions
}
......
......@@ -81,6 +81,11 @@ public class AbstractObservationParser implements ExternalSourceType{
this.factory = factory;
}
/**
* TODO move method to ObservationSupplier
* @param supplier
* @return
*/
public static Spliterator<Observation> nonNullSpliterator(Supplier<Observation> supplier){
return new NonNullSpliterator(supplier);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment