Ignore:
Timestamp:
06/06/18 00:45:50 (6 years ago)
Author:
Maciej Komosinski
Message:

Unified error messages and error handling for loadSingleLine and loadMultiLine

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/param/param.h

    r786 r796  
    252252};
    253253
    254 template<typename T> struct quote_in_messages { constexpr static const char* value = "'"; };
    255 template<> struct quote_in_messages < SString > { constexpr static const char* value = "\""; };
    256 template<typename T> struct length_in_messages { static const bool value = false; };
    257 template<> struct length_in_messages < SString > { static const bool value = true; };
    258 
    259254class SimpleAbstractParam : public virtual ParamInterface
    260255{
     
    300295                if (setflags & (PSET_HITMIN | PSET_HITMAX))
    301296                {
    302                         SString svaluetoset = SString::valueOf(valuetoset); //converts any type to SString
    303                         SString actual = get(i);
    304                         bool s_type = type(i)[0] == 's';
    305                         logPrintf("Param", "set", LOG_WARN, "Setting %s.%s = %s exceeded allowed range (too %s). %s to %s.",
    306                                 getName(), id(i),
    307                                 ::sstringDelimitAndShorten(svaluetoset, 30, length_in_messages<T>::value, quote_in_messages<T>::value, quote_in_messages<T>::value).c_str(),
    308                                 (setflags&PSET_HITMAX) ? (s_type ? "long" : "big") : "small", s_type ? "Truncated" : "Adjusted",
    309                                 ::sstringDelimitAndShorten(actual, 30, length_in_messages<T>::value, quote_in_messages<T>::value, quote_in_messages<T>::value).c_str()
    310                                 );
     297                        ExtValue v(valuetoset);
     298                        messageOnExceedRangeExtValue(i, setflags, v);
    311299                }
    312300        }
     301        void messageOnExceedRangeExtValue(int i, int setflags, ExtValue& valuetoset); ///< used by messageOnExceedRange() internally
    313302
    314303        int setInt(int, paInt);
Note: See TracChangeset for help on using the changeset viewer.