Git Product home page Git Product logo

Comments (8)

PabstMirror avatar PabstMirror commented on June 26, 2024 3
addMissionEventHandler ["ScriptError", {
    params ["_errorText", "_sourceFile", "_lineNumber", "_errorPos", "_content", "_stackTraceOutput"];
    private _src = _stackTraceOutput # 0;
    if ((_src#0 == "x\cba\addons\common\XEH_postInit.sqf") && {(_src#1 == 5)}) then {
        private _pfID = (_stackTraceOutput#2#3) get "_handle";
        systemChat format ["PFEH %1 has failed and will be removed", _pfID];
        diag_log text format ["PFEH %1 has failed and will be removed", _pfID];
        [_pfID] call CBA_fnc_removePerFrameHandler;
    };
}];

you can add that code and it should catch any failing PFEHs and remove them

but this doesn't belong in CBA because it could break things by removing a PFEH that only fails once
we could use a isNil wrapper but that has a perf penalty
ultimately the best solution is to not have code that can error

from cba_a3.

commy2 avatar commy2 commented on June 26, 2024 1

Code that breaks stuff should not be endorsed, even by being optional. Everything works as expected as is.

from cba_a3.

Nerexis avatar Nerexis commented on June 26, 2024

Solution can be based on my code here: https://pastebin.com/f7LDJxGv

from cba_a3.

commy2 avatar commy2 commented on June 26, 2024

Introduce a perFrameHandler that has a long execution time or gets stuck (e.g., infinite loop).

For example?

from cba_a3.

PabstMirror avatar PabstMirror commented on June 26, 2024
[{systemChat format ["A: %1", time];}, 0, []] call CBA_fnc_addPerFrameHandler; 
[{5 == []}, 0, []] call CBA_fnc_addPerFrameHandler; 
[{systemChat format ["C: %1", time];}, 0, []] call CBA_fnc_addPerFrameHandler;

C never runs

from cba_a3.

Dystopian avatar Dystopian commented on June 26, 2024

but this doesn't belong in CBA

maybe add this as optional

from cba_a3.

Nerexis avatar Nerexis commented on June 26, 2024

Could we consider making this code more resilient by optionally adding an isNil check (switch in Addons options?)? This would help in scenarios where it's crucial to avoid crashes and ensure continuity of operation, much like landing a satellite on the moon. A failure in one PFH shouldn’t compromise the entire landing operation (high-stakes, high-reliability scenarios).

from cba_a3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.