Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify error tracing API #17

Open
janodvarko opened this issue Jun 26, 2014 · 9 comments
Open

Simplify error tracing API #17

janodvarko opened this issue Jun 26, 2014 · 9 comments
Assignees

Comments

@janodvarko
Copy link
Member

It would be great if error tracing can be done using following API.

try {
}
catch (err) {
TraceError.sysoutError(err);
}

no need to specify the "EXCEPTION" keyword, the log should be red in the tracing console automatically.

Currently we have to:
TraceError.sysout("Grip.getProps; EXCEPTION " + err, err);

@fflorent: since you are working on issue #1, perhaps you could do this one too?

Honza


Edit: Good first bug. Basically, the idea is to test if:

  1. The method was called using TraceError.sysout()
  2. the first argument is an exception.

If it is the case (let err be the exception argument):

  1. Get the name of the calling method using err.stack (or maybe Components.stack if it doesn't provide the name)
  2. Print the equivalent of: TraceError.sysout("<name of the calling method>; EXCEPTION " + err, err);

TraceError is initialised in lib/core/trace.js

Florent

@simonlindholm
Copy link
Member

And we can get access to a "Grip.getProps"-like string by looking at Components.stack.

It does bother me a little that the name "sysoutError" is so long, maybe we can instead go with just "TraceError.sysout" or "TraceError.error".

@janodvarko
Copy link
Member Author

It's just that sysout normally expects a label and an object. That's why I suggested another method (that can auto generate it).

Is it really so long? It's like 5 more characters...
In any case, if it's really a trouble, "TraceError.error" would work for me too..

Honza

@simonlindholm
Copy link
Member

It's not that bad, it just bugs me slightly, and it's easier to change now.

@fflorent
Copy link
Member

fflorent commented Jul 5, 2014

It bugs me also a bit.
Maybe then TraceError.syserr(err)?

(anyway, we will be able to change it easily, so I'll start with TraceError.sysoutError(err)` until we all agree on a name)

Florent

@janodvarko
Copy link
Member Author

Ok, I added it to the agenda.
Honza

@fflorent
Copy link
Member

fflorent commented Dec 6, 2014

Thinking of it, we could just test TraceError.sysout first argument if this is an instance of Error or not, and do special treatments if it is the case.

Florent

@janodvarko
Copy link
Member Author

we could just test TraceError.sysout first argument if this is an instance of Error or not,
and do special treatments if it is the case.

Yep, I like the idea.

Honza

@fflorent
Copy link
Member

The first post is updated according to what has been said in the thread.

@aliuk2012 is working on it.

Florent

@admsugar admsugar self-assigned this Feb 5, 2015
@janodvarko
Copy link
Member Author

@admsugar: ping, any news? :-)

Honza

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants