The 'stack' property is a getter.  So, it's not constructed until you
actually resolve it by trying to get it.

Try `console.log(er.stack)` and you'll see it.

On Fri, Feb 15, 2013 at 6:11 AM, Sébastien Dolard <[email protected]> wrote:
> Hi,
>
> Where is the stack ?
> I've got only this to my console: 'Error: ENOENT, open 'invalid filename'
>
>
> var
> fs = require('fs'),
> domain = require('domain'),
> d = domain.create();
>
> function readSomeFile(filename, cb) {
>   fs.readFile(filename, 'utf8', d.bind(function(er, data) {
>     // if this throws, it will also be passed to the domain
>     return cb(er, data ? JSON.parse(data) : null);
>   }));
> }
>
> d.on('error', function(er) {
>   // an error occurred somewhere.
>   // if we throw it now, it will crash the program
>   // with the normal line number and stack message.
>   console.log(er); // where is the stack
>
> });
>
> readSomeFile('invalid filename', function(er, data){
> if (er) {
> throw er;
> }
> });
>
> --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to