Giter VIP home page Giter VIP logo

Comments (5)

HarelM avatar HarelM commented on July 18, 2024

I think solving the following issue will probably avoid this scenario.
Adding a try-catch probably can't hurt much, but still feeling like adding a patch and not a real solution.

from maplibre-gl-js.

kaij avatar kaij commented on July 18, 2024

I think solving the following issue will probably avoid this scenario. Adding a try-catch probably can't hurt much, but still feeling like adding a patch and not a real solution.

I also feel like adding exception handler feels like a hack and that it would be best to solve this at the source. However, can the camera really be kept above terrain at all times. What about an animated camera using freezeElevation=true?

If it helps, I can add these handlers in a pull request. Another solution could be to prevent the LatLng constructor from throwing errors in such cases, e.g. adding a parameter flag like silent=true at some point?

from maplibre-gl-js.

HarelM avatar HarelM commented on July 18, 2024

Yes, there was an initial PR to do it, but it changed the map settings so it needed more work:

from maplibre-gl-js.

olsen232 avatar olsen232 commented on July 18, 2024

I feel that a try/catch or similar - although it may feel like you have simply hacked around the problem - is actually pretty valid here:

  • try/catch was invented to let you recover from unrecoverable errors. Deciding not to catch (or suppress in some way) this error would be a good choice if this error is unrecoverable. But is this really an unrecoverable error?
  • it's true, you are hoping to solve this problem at the source, and it would be good to keep the camera above the terrain at all times. But a) that's not done yet and b) wouldn't it be better if the various subsystems were robust against failure in other subsystems? Right now by having each subsystem relying on the assumption that every other subsystem is working perfectly (even though we know they are not), this is designing to encourage a cascading failure.

from maplibre-gl-js.

HarelM avatar HarelM commented on July 18, 2024

Your points are valid, and I won't reject a PR to patch the code until we properly fix the problem. I would advise to add a comment to saying this should be removed after the issue is resolved.
We are talking about the same system, and I prefer not to write "defensive programming" if possible, and fix the source of a problem when possible. It's not always possible, I know, but I'm trying to aim high.

from maplibre-gl-js.

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.