Class GlideException

  • All Implemented Interfaces:
    java.io.Serializable

    public final class GlideException
    extends java.lang.Exception
    An exception with zero or more causes indicating why a load in Glide failed.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      GlideException​(java.lang.String message)  
      GlideException​(java.lang.String detailMessage, java.lang.Throwable cause)  
      GlideException​(java.lang.String detailMessage, java.util.List<java.lang.Throwable> causes)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Throwable fillInStackTrace()  
      java.util.List<java.lang.Throwable> getCauses()
      Returns a list of causes that are immediate children of this exception.
      java.lang.String getMessage()  
      java.lang.Exception getOrigin()
      Returns an Exception with a stack trace that includes where the request originated (if previously set via setOrigin(Exception))
      java.util.List<java.lang.Throwable> getRootCauses()
      Returns the list of root causes that are the leaf nodes of all children of this exception.
      void logRootCauses​(java.lang.String tag)
      Logs all root causes using the given tag.
      void printStackTrace()  
      void printStackTrace​(java.io.PrintStream err)  
      void printStackTrace​(java.io.PrintWriter err)  
      void setOrigin​(java.lang.Exception exception)
      Sets a stack trace that includes where the request originated.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • GlideException

        public GlideException​(java.lang.String message)
      • GlideException

        public GlideException​(java.lang.String detailMessage,
                              java.lang.Throwable cause)
      • GlideException

        public GlideException​(java.lang.String detailMessage,
                              java.util.List<java.lang.Throwable> causes)
    • Method Detail

      • setOrigin

        public void setOrigin​(@Nullable
                              java.lang.Exception exception)
        Sets a stack trace that includes where the request originated.

        This is an experimental API that may be removed in the future.

      • getOrigin

        @Nullable
        public java.lang.Exception getOrigin()
        Returns an Exception with a stack trace that includes where the request originated (if previously set via setOrigin(Exception))

        This is an experimental API that may be removed in the future.

      • fillInStackTrace

        public java.lang.Throwable fillInStackTrace()
        Overrides:
        fillInStackTrace in class java.lang.Throwable
      • getCauses

        public java.util.List<java.lang.Throwable> getCauses()
        Returns a list of causes that are immediate children of this exception.

        Causes may or may not be GlideExceptions. Causes may also not be root causes, and in turn my have been caused by other failures.

        See Also:
        getRootCauses()
      • getRootCauses

        public java.util.List<java.lang.Throwable> getRootCauses()
        Returns the list of root causes that are the leaf nodes of all children of this exception.

        Use this method to do things like look for http exceptions that indicate the load may have failed due to an error that can be retried. Keep in mind that because Glide may attempt to load a given model using multiple different pathways, there may be multiple related or unrelated reasons for a load to fail.

      • logRootCauses

        public void logRootCauses​(java.lang.String tag)
        Logs all root causes using the given tag.

        Each root cause is logged separately to avoid throttling. printStackTrace() will provide a more succinct overview of why the exception occurred, although it does not include complete stack traces.

      • printStackTrace

        public void printStackTrace()
        Overrides:
        printStackTrace in class java.lang.Throwable
      • printStackTrace

        public void printStackTrace​(java.io.PrintStream err)
        Overrides:
        printStackTrace in class java.lang.Throwable
      • printStackTrace

        public void printStackTrace​(java.io.PrintWriter err)
        Overrides:
        printStackTrace in class java.lang.Throwable
      • getMessage

        public java.lang.String getMessage()
        Overrides:
        getMessage in class java.lang.Throwable