Giter VIP home page Giter VIP logo

Comments (3)

Afforess avatar Afforess commented on June 12, 2024

I wrote a test case to verify that the event was properly sending error messages to players, and it is. I think everything is working as intended, but the problem is that if there are no players online or capable of seeing the message, then the error is essentially hidden from the game. This is why:

(From Event.lua)

            local success, err = pcall(handler, event)
            if not success then
                -- may be nil in on_load
                if _G.game then
                    Game.print_all(err)
                else
                    -- no way to handle errors cleanly when the game is not up
                    error(err)
                end
                return
            end

When the game exists (and it does in your event), then it tries to run Game.print_all with the error message, but if there aren't any players to receive the message, then print_all isn't terribly useful. I think I can improve this - print_all returns the number of players notified, and if this is zero, then I'll raise the error the same way factorio does, so it isn't hidden.

from factorio-stdlib.

Afforess avatar Afforess commented on June 12, 2024

The fix is in Factorio Standard Library 0.5.1.

from factorio-stdlib.

mojo2012 avatar mojo2012 commented on June 12, 2024

I'll try it out today, thanks.

from factorio-stdlib.

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.