Skip to content

Stacktrace doesn't show the line responsible for error #22

@dnafication

Description

@dnafication

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions