fix(error): update error mapper
This commit is contained in:
parent
4e9686d6a7
commit
1b39c438bf
@ -2,18 +2,20 @@ package fr.titionfire.ffsaf.rest.exception;
|
||||
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import jakarta.ws.rs.ext.ExceptionMapper;
|
||||
import jakarta.ws.rs.ext.Provider;
|
||||
import org.jboss.resteasy.reactive.server.ServerExceptionMapper;
|
||||
import org.jboss.resteasy.reactive.server.UnwrapException;
|
||||
|
||||
@Provider
|
||||
public class DetailExceptionMapper implements ExceptionMapper<DetailException> {
|
||||
import java.util.concurrent.CompletionException;
|
||||
|
||||
@Override
|
||||
public Response toResponse(DetailException e) {
|
||||
@UnwrapException({CompletionException.class, RuntimeException.class})
|
||||
public class DetailExceptionMapper{
|
||||
|
||||
@ServerExceptionMapper
|
||||
public Response mapException(DetailException e) {
|
||||
System.out.println("DetailExceptionMapper: " + e.getMessage());
|
||||
return Response.status(e.getStatus())
|
||||
.entity(e.getMessage())
|
||||
.type(MediaType.TEXT_PLAIN_TYPE)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import {useLoadingSwitcher} from "../../../hooks/useLoading.jsx";
|
||||
import {apiAxios} from "../../../utils/Tools.js";
|
||||
import {apiAxios, errFormater} from "../../../utils/Tools.js";
|
||||
import {toast} from "react-toastify";
|
||||
import imageCompression from "browser-image-compression";
|
||||
import {BirthDayField, CountryList, OptionField, RoleList, TextField} from "../../../components/MemberCustomFiels.jsx";
|
||||
@ -70,7 +70,7 @@ export function InformationForm({data}) {
|
||||
toast.success('Profile mis à jours avec succès 🎉');
|
||||
}).catch(e => {
|
||||
console.log(e.response)
|
||||
toast.error('Échec de la mise à jours du profile 😕 (code: ' + e.response.status + ')');
|
||||
toast.error(errFormater(e,'Échec de la mise à jours du profile 😕'));
|
||||
}).finally(() => {
|
||||
if (setLoading)
|
||||
setLoading(0)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user