Ferreteria/v0.6/clade/Sys/Diag/Break/Native/@code/cur/2026/06/01

From WoozleCodes
Jump to navigation Jump to search
2026/05/31 2026/06/01 2026/06/02

The commented-out stuff here was commented out a long time ago (date unknown); I'm just preserving the whole thing here because I'm kinda diving back into this without being sure of what I was doing, and I want tidying-up to be okay.

/* Base* [ca,i] */ use Woozalia\Ferret\Sys\Diag\{ caBreak as BaseClass, iBreak as BaseIface };
/* ErrorClass   */ use Woozalia\Ferret\Sys\Diag\Break\aux\cError as ErrorClass;
/* FlineClass   */ use Woozalia\Ferret\Sys\Diag\Break\aux\cFline as FlineClass;
/* QObj*  [c,i] */ use Woozalia\Ferret\Data\Mem\QVar\RW\{ cObj as QObjClass, iObj as QObjIface };

interface iNative extends BaseIface {}
abstract class caNative extends BaseClass implements iNative {

    // ++ SETUP ++ //

    // should probably also be FromErrorInfo() or similar... but maybe nothing needs that?

    // -- SETUP -- //
    // ++ OBJECTS ++ //

    #private $osErr = NULL; public function QError() : QObjIface { return $this->osErr ?? ($this->osErr = QObjClass::AsNew()); }
    #private $osFln = NULL; public function QFline() : QObjIface { return $this->osFln ?? ($this->osFln = QObjClass::AsNew()); }

    // -- OBJECTS -- //
    // ++ OUTPUT ++ //

    /**
     * THINKING: 2024-08-25 This method is in this class with the idea that it is supposed to report any kind of error,
     *  including Throws, that may have happened during execution. For now, it only checks Legacy errors because there's
     *  a handy native function for that.
     */
    static public function ShowStatus() : string {
        #$sOut = '(no additional errors found)'; // Default: no error
        $sOut = '';
        #$osErr = $this->QError();
        #if ($osErr->HasIt()) {
            // There was an error intercepted earlier -- note that it happened:
        #    $sOut = "Error caught earlier: ".$oErr->RenderLine().CRLF;
        #} else {
            $arErr = error_get_last();
            if (is_array($arErr)) {
                $oErr = ErrorClass::FromDetails($arErr["message"],$arErr["type"]);
                $oFln = FlineClass::FromDetails($arErr["file"],$arErr["line"]);

                $sOut = $oErr->SummaryLine().' at '.$oFln->SummaryLine();
            }
        #}
        return $sOut;
    }
}