@@ -385,7 +385,7 @@ Value & AttrCursor::getValue()
385385 if (!_value) {
386386 if (parent) {
387387 auto & vParent = parent->first ->getValue ();
388- root->state .forceAttrs (vParent, noPos, " while searching for an attribute " );
388+ root->state .forceAttrs (vParent, noPos);
389389 auto attr = vParent.attrs ->get (parent->second );
390390 if (!attr)
391391 throw Error (" attribute '%s' is unexpectedly missing" , getAttrPathStr ());
@@ -571,14 +571,14 @@ std::string AttrCursor::getString()
571571 debug (" using cached string attribute '%s'" , getAttrPathStr ());
572572 return s->first ;
573573 } else
574- root->state .error ( " '%s' is not a string" , getAttrPathStr ()). debugThrow <TypeError>( );
574+ root->state .debugThrowLastTrace ( TypeError ( " '%s' is not a string" , getAttrPathStr ()));
575575 }
576576 }
577577
578578 auto & v = forceValue ();
579579
580580 if (v.type () != nString && v.type () != nPath)
581- root->state .error ( " '%s' is not a string but %s" , getAttrPathStr ()). debugThrow <TypeError>( );
581+ root->state .debugThrowLastTrace ( TypeError ( " '%s' is not a string but %s" , getAttrPathStr (), showType (v. type ())) );
582582
583583 return v.type () == nString ? v.string .s : v.path ;
584584}
@@ -613,7 +613,7 @@ string_t AttrCursor::getStringWithContext()
613613 return *s;
614614 }
615615 } else
616- root->state .error ( " '%s' is not a string" , getAttrPathStr ()). debugThrow <TypeError>( );
616+ root->state .debugThrowLastTrace ( TypeError ( " '%s' is not a string" , getAttrPathStr ()));
617617 }
618618 }
619619
@@ -624,7 +624,7 @@ string_t AttrCursor::getStringWithContext()
624624 else if (v.type () == nPath)
625625 return {v.path , {}};
626626 else
627- root->state .error ( " '%s' is not a string but %s" , getAttrPathStr ()). debugThrow <TypeError>( );
627+ root->state .debugThrowLastTrace ( TypeError ( " '%s' is not a string but %s" , getAttrPathStr (), showType (v. type ())) );
628628}
629629
630630bool AttrCursor::getBool ()
@@ -637,14 +637,14 @@ bool AttrCursor::getBool()
637637 debug (" using cached Boolean attribute '%s'" , getAttrPathStr ());
638638 return *b;
639639 } else
640- root->state .error ( " '%s' is not a Boolean" , getAttrPathStr ()). debugThrow <TypeError>( );
640+ root->state .debugThrowLastTrace ( TypeError ( " '%s' is not a Boolean" , getAttrPathStr ()));
641641 }
642642 }
643643
644644 auto & v = forceValue ();
645645
646646 if (v.type () != nBool)
647- root->state .error ( " '%s' is not a Boolean" , getAttrPathStr ()). debugThrow <TypeError>( );
647+ root->state .debugThrowLastTrace ( TypeError ( " '%s' is not a Boolean" , getAttrPathStr ()));
648648
649649 return v.boolean ;
650650}
@@ -696,7 +696,7 @@ std::vector<std::string> AttrCursor::getListOfStrings()
696696 std::vector<std::string> res;
697697
698698 for (auto & elem : v.listItems ())
699- res.push_back (std::string (root->state .forceStringNoCtx (*elem, noPos, " while evaluating an attribute for caching " )));
699+ res.push_back (std::string (root->state .forceStringNoCtx (*elem)));
700700
701701 if (root->db )
702702 cachedValue = {root->db ->setListOfStrings (getKey (), res), res};
@@ -714,14 +714,14 @@ std::vector<Symbol> AttrCursor::getAttrs()
714714 debug (" using cached attrset attribute '%s'" , getAttrPathStr ());
715715 return *attrs;
716716 } else
717- root->state .error ( " '%s' is not an attribute set" , getAttrPathStr ()). debugThrow <TypeError>( );
717+ root->state .debugThrowLastTrace ( TypeError ( " '%s' is not an attribute set" , getAttrPathStr ()));
718718 }
719719 }
720720
721721 auto & v = forceValue ();
722722
723723 if (v.type () != nAttrs)
724- root->state .error ( " '%s' is not an attribute set" , getAttrPathStr ()). debugThrow <TypeError>( );
724+ root->state .debugThrowLastTrace ( TypeError ( " '%s' is not an attribute set" , getAttrPathStr ()));
725725
726726 std::vector<Symbol> attrs;
727727 for (auto & attr : *getValue ().attrs )
0 commit comments