Closed TranVanDung-Leo closed 1 year ago
Please provide the code that produces the table with this behavior for attempting to reproduce your issue.
try {
throw new Error("This article shows how to fetch GraphQL data in React with the useQuery hook and attach the result to your UI. You'll also learn how Apollo Client simplifies data management code by tracking error and loading states for you. { data: This article shows how to fetch GraphQL data in React with the useQuery hook and attach the result to your UI. You'll also learn how Apollo Client \n simplifies data management code by tracking error and loading states for you, data2: This article shows how to fetch GraphQL data in React with the useQuery hook and attach the result to your UI. You'll also learn how Apollo Client simplifies data management code by tracking error and loading states for you}");
} catch (error) {
var table = new Table({
head: [String(error)],
colWidths: [74],
wordWrap: true,
});
table.push([
error.stack
.split(/\n+/)
.map((line) => line.trim())
.filter((line) => line.startsWith("at "))
.join("\n"),
]);
console.log(table.toString());
}
"Words" (non-space delimited strings) that exceed your column width are being truncated instead of wrapped.
Try adding the option wrapOnWordBoundary: false
to your table options.
This option is described here.
Eg.
var table = new Table({
head: [String(error)],
colWidths: [74],
wordWrap: true,
wrapOnWordBoundary: false,
});
When I show error.stack of an Error Example: Error("This article shows how to fetch GraphQL data in React with the useQuery hook and attach the result to your UI. You'll also learn how Apollo Client simplifies data management code by tracking error and loading states for you. { data: This article shows how to fetch GraphQL data in React with the useQuery hook and attach the result to your UI. You'll also learn how Apollo Client \n simplifies data management code by tracking error and loading states for you, data2: This article shows how to fetch GraphQL data in React with the useQuery hook and attach the result to your UI. You'll also learn how Apollo Client simplifies data management code by tracking error and loading states for you}");