mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-25 23:44:54 +01:00
Add more debug.
This commit is contained in:
parent
00fd168489
commit
71762ff629
@ -28,4 +28,8 @@ abstract public class ClientException extends WiseMappingException {
|
||||
public Severity getSeverity() {
|
||||
return this.severity;
|
||||
}
|
||||
|
||||
public String getTechInfo() {
|
||||
return getMessage();
|
||||
}
|
||||
}
|
||||
|
@ -25,9 +25,9 @@ public class MultipleSessionsOpenException
|
||||
{
|
||||
public static final String MSG_KEY = "MINDMAP_OUTDATED_BY_YOU";
|
||||
|
||||
public MultipleSessionsOpenException(@NotNull String msg)
|
||||
public MultipleSessionsOpenException(@NotNull String techInfo)
|
||||
{
|
||||
super(msg,Severity.INFO);
|
||||
super(techInfo,Severity.INFO);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
@ -108,6 +108,6 @@ public class BaseController {
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
public RestErrors handleClientErrors(@NotNull ClientException ex) {
|
||||
final Locale locale = LocaleContextHolder.getLocale();
|
||||
return new RestErrors(ex.getMessage(messageSource, locale),ex.getSeverity());
|
||||
return new RestErrors(ex.getMessage(messageSource, locale),ex.getSeverity(),ex.getTechInfo());
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.validation.Errors;
|
||||
@ -56,6 +57,10 @@ public class RestErrors {
|
||||
@JsonIgnore
|
||||
Severity gSeverity;
|
||||
|
||||
@Nullable
|
||||
@JsonIgnore
|
||||
private String _debugInfo;
|
||||
|
||||
public RestErrors() {
|
||||
|
||||
}
|
||||
@ -64,17 +69,23 @@ public class RestErrors {
|
||||
|
||||
this.errors = errors;
|
||||
this.messageSource = messageSource;
|
||||
this.gErrors = this.processGlobalErrors(errors, messageSource);
|
||||
this.gErrors = this.processGlobalErrors(errors);
|
||||
this.gSeverity = Severity.WARNING;
|
||||
}
|
||||
|
||||
public RestErrors(@NotNull String errorMsg, @NotNull Severity severity) {
|
||||
gErrors = new ArrayList<String>();
|
||||
gErrors.add(errorMsg);
|
||||
|
||||
this(errorMsg, severity, null);
|
||||
}
|
||||
|
||||
public RestErrors(@NotNull String errorMsg, @NotNull Severity severity, @Nullable String debugInfo) {
|
||||
this._debugInfo = debugInfo;
|
||||
this.gErrors = new ArrayList<String>();
|
||||
this.gErrors.add(errorMsg);
|
||||
this.gSeverity = severity;
|
||||
}
|
||||
|
||||
private List<String> processGlobalErrors(@NotNull Errors errors, @NotNull MessageSource messageSource) {
|
||||
private List<String> processGlobalErrors(@NotNull Errors errors) {
|
||||
final List<String> result = new ArrayList<String>();
|
||||
final List<ObjectError> globalErrors = errors.getGlobalErrors();
|
||||
for (ObjectError globalError : globalErrors) {
|
||||
@ -83,10 +94,6 @@ public class RestErrors {
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<String> getGlobalErrors() {
|
||||
return gErrors;
|
||||
}
|
||||
|
||||
public void setGlobalErrors(List<String> list) {
|
||||
// Implemented only for XML serialization contract ...
|
||||
}
|
||||
@ -111,7 +118,23 @@ public class RestErrors {
|
||||
// Implemented only for XML serialization contract ...
|
||||
}
|
||||
|
||||
public void setDebugInfo(@Nullable String debugInfo) {
|
||||
// Implemented only for XML serialization contract ...
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public String getGlobalSeverity() {
|
||||
return this.gSeverity.toString();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getDebugInfo() {
|
||||
return _debugInfo;
|
||||
}
|
||||
|
||||
public List<String> getGlobalErrors() {
|
||||
return gErrors;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user