lib/nrser/errors/nicer_error.rb
# Get the message or the extended message.
# 
# @note
#   This is a bit weird, having to do with what I can tell about the
#   built-in errors and how they handle their message - they have *no*
#   instance variables, and seem to rely on `#to_s` to get the message
#   out of C-land, however that works.
#   
#   {Exception#message} just forwards here, so I overrode that with
#   {#message} to just get the *summary/super-message* from this method.
# 
# @param [Boolean?] extended
#   Flag to explicitly control summary/super or extended message:
#   
#   1.  `nil` - call {#add_extended_message?} to decide (default).
#   2.  `false` - return just the *summary/super-message*.
#   3.  `true` - always add the *extended message* (unless it's empty).
# 
# @return [String]
# 
Get the message or the extended message.
Get the message or the extended message .
def to_s extended: nil
    message = super()
    return message if extended == false
    Either way, don't add it it's empty.
    if  (extended || add_extended_message?) &&
        !extended_message.empty?
      message + "\n\n" + extended_message
    else
      message
    end
  end
def to_s extended : nil message = super ( ) return message if extended == false if ( extended || add_extended_message? ) && ! extended_message . empty? message + "\n\n" + extended_message else message end end
Get the message or the extended message.
Get the message or the extended message .
# The way to get the superclass' message # If `extended` is explicitly `false` then just return that # Otherwise, see if the extended message was explicitly requested, # of if we're configured to provide it as well. #  # Either way, don't add it it's empty. # 
None
String
extended
<not_specific>
<not_specific>
extended Flag to explicitly control summary/super or extended message: 1. `nil` - call {#add_extended_message?} to decide (default). 2. `false` - return just the *summary/super-message*. 3. `true` - always add the *extended message* (unless it's empty).
extended Flag to explicitly control summary / super or extended message : 1 . ` nil ` - call { #add_extended_message? } to decide ( default ) . 2 . ` false ` - return just the * summary / super - message * . 3 . ` true ` - always add the * extended message * ( unless it ' s empty ) .
note
This is a bit weird, having to do with what I can tell about the built-in errors and how they handle their message - they have *no instance variables, and seem to rely on `#to_s` to get the message out of C-land, however that works. {Exception#message} just forwards here, so I overrode that with {#message} to just get the *summary/super-message* from this method.
This is a bit weird having to do with what I can tell about the built - in errors and how they handle their message - they have * no instance variables and seem to rely on ` #to_s ` to get the message out of C - land however that works . { Exception#message } just forwards here so I overrode that with { #message } to just get the * summary / super - message * from this method .