fix(serde-ext): Add paths to TweedReadIssue and TweedEntryWriteException
This commit is contained in:
+4
-4
@@ -7,22 +7,22 @@ public class TweedEntryWriteException extends Exception {
|
||||
private final TweedWriteContext context;
|
||||
|
||||
public TweedEntryWriteException(String message, TweedWriteContext context) {
|
||||
super(message);
|
||||
super("At " + context.currentValuePath() + ": " + message);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public TweedEntryWriteException(String message, Throwable cause, TweedWriteContext context) {
|
||||
super(message, cause);
|
||||
super("At " + context.currentValuePath() + ": " + message, cause);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public TweedEntryWriteException(String message, TweedEntryWriteException cause) {
|
||||
super(message, cause);
|
||||
super("At " + cause.context.currentValuePath() + ": " + message, cause);
|
||||
this.context = cause.context;
|
||||
}
|
||||
|
||||
public TweedEntryWriteException(Throwable cause, TweedWriteContext context) {
|
||||
super(cause);
|
||||
super("At " + context.currentValuePath() + ": " + cause.getMessage(), cause);
|
||||
this.context = context;
|
||||
}
|
||||
}
|
||||
|
||||
+12
-2
@@ -2,6 +2,7 @@ package de.siphalor.tweed5.serde.extension.api.read.result;
|
||||
|
||||
|
||||
import de.siphalor.tweed5.serde.extension.api.TweedReadContext;
|
||||
import de.siphalor.tweed5.serde.extension.api.path.EntryPath;
|
||||
import lombok.*;
|
||||
|
||||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@@ -10,13 +11,22 @@ public class TweedReadIssue {
|
||||
@Getter
|
||||
private final Exception exception;
|
||||
private final TweedReadContext readContext;
|
||||
@Getter
|
||||
private final EntryPath entryPath;
|
||||
@Getter
|
||||
private final EntryPath valuePath;
|
||||
|
||||
public static TweedReadIssue error(String message, TweedReadContext readContext) {
|
||||
return new TweedReadIssue(new Exception(message), readContext);
|
||||
return error(new Exception(message), readContext);
|
||||
}
|
||||
|
||||
public static TweedReadIssue error(Exception exception, TweedReadContext readContext) {
|
||||
return new TweedReadIssue(exception, readContext);
|
||||
return new TweedReadIssue(
|
||||
exception,
|
||||
readContext,
|
||||
readContext.currentEntryPath(),
|
||||
readContext.currentValuePath()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user