Exception: Prismic::Error
- Inherits:
 - 
      Exception
      
        
- Object
 - Exception
 - Prismic::Error
 
 
- Defined in:
 - lib/prismic.rb
 
Overview
These exception can contains an error cause and is able to show them
Direct Known Subclasses
API::BadPrismicResponseError, API::PrismicWSAuthError, API::PrismicWSConnectionError, Fragments::Image::ViewDoesNotExistException, SearchForm::AuthenticationException, SearchForm::AuthorizationException, SearchForm::FormSearchException, SearchForm::NoRefSetException, SearchForm::RefNotFoundException, SearchForm::UnsupportedFormKind
Instance Attribute Summary collapse
- 
  
    
      #cause  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute cause.
 
Instance Method Summary collapse
- 
  
    
      #full_trace(e = self)  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    
Return the full trace of the error (including nested errors).
 - 
  
    
      #initialize(msg = nil, cause = nil)  ⇒ Error 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Error.
 
Constructor Details
#initialize(msg = nil, cause = nil) ⇒ Error
Returns a new instance of Error
      19 20 21 22  | 
    
      # File 'lib/prismic.rb', line 19 def initialize(msg=nil, cause=nil) msg ? super(msg) : msg @cause = cause end  | 
  
Instance Attribute Details
#cause ⇒ Object (readonly)
Returns the value of attribute cause
      18 19 20  | 
    
      # File 'lib/prismic.rb', line 18 def cause @cause end  | 
  
Instance Method Details
#full_trace(e = self) ⇒ String
Return the full trace of the error (including nested errors)
      28 29 30 31 32 33 34 35 36  | 
    
      # File 'lib/prismic.rb', line 28 def full_trace(e=self) first, *backtrace = e.backtrace msg = e == self ? "" : "Caused by " msg += "#{first}: #{e.} (#{e.class})" stack = backtrace.map{|s| "\tfrom #{s}" }.join("\n") cause = e.respond_to?(:cause) ? e.cause : nil cause_stack = cause ? full_trace(cause) : nil [msg, stack, cause_stack].compact.join("\n") end  |