Code Monkey home page Code Monkey logo

Comments (11)

rctoris avatar rctoris commented on June 25, 2024

We made a decision a while back to keep console output to a minimum since it often is abused in JS and can lead to a loss in performance. In place of it, we use EventEmitter2 to keep errors (and other output) event driven for those who are concerned with it (

roslibjs/build/roslib.js

Lines 380 to 382 in 9938d1b

function onError(event) {
that.emit('error', event);
}
)

I believe an error is printed to the console if an error is emitted and it's unhandled. For example, you could do:

  Ros ros = new ROSLIB.Ros();
  ros.on('error', function(error) {
    console.log(error);
  });

  ...

from roslibjs.

jbohren avatar jbohren commented on June 25, 2024

We made a decision a while back to keep console output to a minimum since it often is abused in JS and can lead to a loss in performance.

Yeah, a console message is written, but the console message is completely unhelpful (something along the lines of an "unhandled error"). In the case of the socket failure (which is a very fundamental thing), it would be better if it could report that the problem has to do with sockets in a more obvious way.

A colleague of mine was trying to use the RobotWebTools demos, but nothing was showing up other than the grid and root coordinate triad. It happens that nothing was showing up because the computer in question was on a wireless network which wasn't allowing the necessary ports through. Since the error message contained no information, it necessitated reading through code, downloading, and running a modified version which used the non-minified js scripts to figure out where the error was coming from.

So, since this error can happen even with the demos on the website (which would involve a user's first experience with RobotWebTools), I think an exception should be made to either output a console message, or display a message or alert which very explicitly explains that socket connections aren't being made. If that's still something you don't want to do, then there should at least be a prominent Troubleshooting section in the rosjs README.

from roslibjs.

jbohren avatar jbohren commented on June 25, 2024

(as an aside, these tools are awesome!)

from roslibjs.

rctoris avatar rctoris commented on June 25, 2024

👍 Thanks!

from roslibjs.

rctoris avatar rctoris commented on June 25, 2024

I think adding something to the README about how to handle errors and get error messages is a good idea. The reason its bad to just pop up alerts is that everyone is going to want to handle errors differently, therefore we added the event handling feature.

from roslibjs.

jbohren avatar jbohren commented on June 25, 2024

I think adding something to the README about how to handle errors and get error messages is a good idea. The reason its bad to just pop up alerts is that everyone is going to want to handle errors differently, therefore we added the event handling feature.

Do you think it would make sense to add an additional error handler just to the demo pages, so that if someone is trying them out they will see something prominent?

from roslibjs.

rctoris avatar rctoris commented on June 25, 2024

Yeah, that's a good idea since it will also explicitly show you how to create handlers.

from roslibjs.

jbohren avatar jbohren commented on June 25, 2024

Yeah, that's a good idea since it will also explicitly show you how to create handlers.

Yeah, that'd be great! Thanks Russell. I'm updating the issue title to reflect that.

from roslibjs.

jihoonl avatar jihoonl commented on June 25, 2024

I think adding something to the README about how to handle errors and get error messages is a good idea.

+1

Yeah, that's a good idea since it will also explicitly show you how to create handlers.

Another +1

:):):)

from roslibjs.

T045T avatar T045T commented on June 25, 2024

The demos now contain a status indicator and the wiki tutorials have been updated to show how to register listeners for the error, close and connection messages.

I'm not closing this issue because I didn't put a note into the README yet.

from roslibjs.

syrnick avatar syrnick commented on June 25, 2024

I added the troubleshooting section f11baf0

from roslibjs.

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.