Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
youfanx committed Oct 15, 2024
1 parent 5b2cf52 commit 6a283d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rxlib/src/main/java/org/rx/core/Reflects.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,15 @@ public Class<?> getClassTrace(int depth) {
throw InvalidException.sneaky(e);
}

registerConvert(String.class, BigDecimal.class, (sv, tt) -> new BigDecimal(sv));
registerConvert(String.class, UUID.class, (sv, tt) -> UUID.fromString(sv));
registerConvert(String.class, Date.class, (sv, tt) -> DateTime.valueOf(sv));
registerConvert(Number.class, Decimal.class, (sv, tt) -> Decimal.valueOf(sv.doubleValue()));
registerConvert(NEnum.class, Integer.class, (sv, tt) -> sv.getValue());
registerConvert(Long.class, Date.class, (sv, tt) -> new Date(sv));
registerConvert(Long.class, DateTime.class, (sv, tt) -> new DateTime(sv, TimeZone.getDefault()));
registerConvert(Date.class, Long.class, (sv, tt) -> sv.getTime());
registerConvert(Date.class, DateTime.class, (sv, tt) -> DateTime.of(sv));
registerConvert(String.class, BigDecimal.class, (sv, tt) -> new BigDecimal(sv));
registerConvert(String.class, UUID.class, (sv, tt) -> UUID.fromString(sv));
registerConvert(NEnum.class, Integer.class, (sv, tt) -> sv.getValue());
}

//region class
Expand Down
2 changes: 2 additions & 0 deletions rxlib/src/main/java/org/rx/spring/Interceptors.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.rx.bean.Tuple;
import org.rx.core.*;
import org.rx.exception.ApplicationException;
import org.rx.exception.TraceHandler;
import org.rx.net.http.HttpClient;
import org.rx.util.Servlets;
import org.rx.util.Validator;
Expand Down Expand Up @@ -137,6 +138,7 @@ public Object onException(Throwable e) {
if (SpringContext.controllerExceptionHandler != null) {
return SpringContext.controllerExceptionHandler.apply(e, msg);
}
TraceHandler.INSTANCE.log(e);
return new ResponseEntity<>(msg, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
Expand Down

0 comments on commit 6a283d0

Please sign in to comment.