jedlik icon indicating copy to clipboard operation
jedlik copied to clipboard

Stacktrace doesn't show the line responsible for error

Open dnafication opened this issue 5 years ago • 1 comments

Describe the bug Creating a simple error such as record not found in the table produces error which doesn't show the line responsible for the error message.

To Reproduce or Sample code Steps to reproduce the behavior or a sample code to reproduce it

// index.js file

const jedlik = require("@peak-ai/jedlik");
const Joi = require("joi");

const schema = Joi.object({
  id: Joi.number().required(),
  name: Joi.string().required(),
  type: Joi.string().allow("admin", "user"),
});

const dynamoDBConfig = {
  region: "ap-southeast-2",
  apiVersion: "2012-08-10",
  endpoint: "http://localhost:8000",
};

// the name of the DynamoDB table the model should write to
// it is assumed this table exists
const Users = new jedlik.Model({ table: "users", schema }, dynamoDBConfig);

async function createTableAndQuery() {
  try {
    // query the database for non existent user
    const user2 = await Users.get({ id: 2 });
  } catch (error) {
    console.log(error);
  }
}

createTableAndQuery();

Running the code above produces error:

node index.js

Error: Not Found
    at DynamoDBClient.<anonymous> (/Users/xxx/xxx/try-jedilik/node_modules/@peak-ai/jedlik/dist/dynamodb-client.js:43:23)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/xxx/xxx/try-jedilik/node_modules/@peak-ai/jedlik/dist/dynamodb-client.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Expected behavior It would be beneficial to have the stacktrace display the line responsible for the error at the user code.

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: [e.g.MacOS] Mac
  • Version [e.g. v0.2.0]
  • node version[node -v] 12
  • npm 6.14

Additional context Add any other context about the problem here.

dnafication avatar Oct 30 '20 10:10 dnafication

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.91. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

issue-label-bot[bot] avatar Oct 30 '20 10:10 issue-label-bot[bot]