Class RestApiExceptionMapperImpl

    • Constructor Detail

      • RestApiExceptionMapperImpl

        public RestApiExceptionMapperImpl​(RestApiExceptionMapperProperties properties,
                                          String applicationName)
        Instantiates a new rest api exception mapper.
        Parameters:
        properties - the properties
        applicationName - the application name
    • Method Detail

      • detectHttpStatus

        public org.springframework.http.HttpStatus detectHttpStatus​(@NotNull
                                                                    @NotNull Throwable exception,
                                                                    @Nullable
                                                                    Object handler)
        Description copied from interface: RestApiExceptionMapper
        Detects the http status.
        Specified by:
        detectHttpStatus in interface RestApiExceptionMapper
        Parameters:
        exception - the exception (required)
        handler - the handler (optional)
        Returns:
        the http status
      • build

        public org.bremersee.exception.model.RestApiException build​(@NotNull
                                                                    @NotNull Throwable exception,
                                                                    @Nullable
                                                                    String requestPath,
                                                                    @Nullable
                                                                    Object handler)
        Description copied from interface: RestApiExceptionMapper
        Build the exception model from the exception, the requested path and an handler. Typically the handler is of type HandlerMethod.
        Specified by:
        build in interface RestApiExceptionMapper
        Parameters:
        exception - the exception (required)
        requestPath - the requested path (optional)
        handler - the handler (optional)
        Returns:
        the rest api exception
      • findHandlerClass

        @Nullable
        protected Class<?> findHandlerClass​(@Nullable
                                            Object handler)
        Find the handler class.
        Parameters:
        handler - the handler
        Returns:
        the class
      • findHandlerMethod

        @Nullable
        protected Method findHandlerMethod​(Object handler)
        Find the handler method.
        Parameters:
        handler - the handler
        Returns:
        the method
      • buildHandler

        @Nullable
        protected org.bremersee.exception.model.Handler buildHandler​(@Nullable
                                                                     Object handler)
        Build the handler model of the rest ape exception.
        Parameters:
        handler - the handler
        Returns:
        the handler model
      • addStackTraceItems

        protected void addStackTraceItems​(@NotNull
                                          @NotNull org.bremersee.exception.model.RestApiException restApiException,
                                          @Nullable
                                          StackTraceElement[] stackTrace)
        Add stack trace items.
        Parameters:
        restApiException - the rest api exception
        stackTrace - the stack trace
      • buildRestApiExceptionCause

        @Nullable
        protected org.bremersee.exception.model.RestApiException buildRestApiExceptionCause​(@Nullable
                                                                                            Throwable cause,
                                                                                            @NotNull
                                                                                            @NotNull RestApiExceptionMapperProperties.ExceptionMappingConfig config)
        Build the cause of a rest api exception.
        Parameters:
        cause - the cause
        config - the config
        Returns:
        the rest api exception