All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.code.rest.exceptions.IOExceptionMapper Maven / Gradle / Ivy

There is a newer version: 37
Show newest version
package io.quarkus.code.rest.exceptions;

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 java.io.IOException;

@Provider
public class IOExceptionMapper implements ExceptionMapper {
    @Override
    public Response toResponse(IOException e) {
        String message = "IO error > " + e.getMessage();
        return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
                .entity(message)
                .type(MediaType.TEXT_PLAIN)
                .build();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy