Class SentryExceptionResolver

java.lang.Object
io.sentry.spring.SentryExceptionResolver
All Implemented Interfaces:
org.springframework.core.Ordered, org.springframework.web.servlet.HandlerExceptionResolver

public class SentryExceptionResolver extends Object implements org.springframework.web.servlet.HandlerExceptionResolver, org.springframework.core.Ordered
HandlerExceptionResolver implementation that will record any exception that a Spring Controller throws to Sentry. It then returns null, which will let the other (default or custom) exception resolvers handle the actual error.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    SentryExceptionResolver(@NotNull io.sentry.IHub hub, @NotNull TransactionNameProvider transactionNameProvider, int order)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected @NotNull io.sentry.SentryEvent
    createEvent(@NotNull javax.servlet.http.HttpServletRequest request, @NotNull Exception ex)
     
    protected @Nullable io.sentry.Hint
    createHint(@NotNull javax.servlet.http.HttpServletRequest request, @NotNull javax.servlet.http.HttpServletResponse response)
     
    int
     
    @Nullable org.springframework.web.servlet.ModelAndView
    resolveException(@NotNull javax.servlet.http.HttpServletRequest request, @NotNull javax.servlet.http.HttpServletResponse response, @Nullable Object handler, @NotNull Exception ex)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • SentryExceptionResolver

      public SentryExceptionResolver(@NotNull @NotNull io.sentry.IHub hub, @NotNull @NotNull TransactionNameProvider transactionNameProvider, int order)
  • Method Details

    • resolveException

      @Nullable public @Nullable org.springframework.web.servlet.ModelAndView resolveException(@NotNull @NotNull javax.servlet.http.HttpServletRequest request, @NotNull @NotNull javax.servlet.http.HttpServletResponse response, @Nullable @Nullable Object handler, @NotNull @NotNull Exception ex)
      Specified by:
      resolveException in interface org.springframework.web.servlet.HandlerExceptionResolver
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered
    • createEvent

      @NotNull protected @NotNull io.sentry.SentryEvent createEvent(@NotNull @NotNull javax.servlet.http.HttpServletRequest request, @NotNull @NotNull Exception ex)
    • createHint

      @Nullable protected @Nullable io.sentry.Hint createHint(@NotNull @NotNull javax.servlet.http.HttpServletRequest request, @NotNull @NotNull javax.servlet.http.HttpServletResponse response)