Skip to content

Logging stack traces when environment is local #143

@omarchehab98

Description

@omarchehab98

When developing locally stack traces are crucial.

Scenario

// functions/__main__.js
const myBrokenHelper = require('../helper');

/**
* A basic Hello World function
* @param {string} name Who you're saying hello to
* @returns {string}
*/
module.exports = (name = 'world', context, callback) => {
  try {
    myBrokenHelper();
  } catch (e) {
    console.log(e.stack);
  }
  callback(null, `hello ${name}`);
};
// helper.js
module.exports = () => console.log(runtimeError)

Expected Outcome

$ lib .
ReferenceError: runtimeError is not defined
    at module.exports (/.../stdlib-stacktrace-pls/dev/hello-broken/help
er.js:1:98)
    at module.exports (/.../stdlib-stacktrace-pls/dev/hello-broken/func
tions/__main__.js:10:5)
    ...

Actual Outcome

$ lib .
Error: runtimeError is not defined

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions