From be88d1524a2c1d269f0bfb316c4e6b2aff51afe4 Mon Sep 17 00:00:00 2001 From: Tom Hill Date: Tue, 15 Jan 2019 12:21:20 +1100 Subject: [PATCH] More verbose error messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi! Love the component. I make the mistake of having miss-matched `value` and `children` props often and I feel the error message in its current form doesn't really assist in solving the error (I had to read the code the first time in order to solve it). This adds a hint suggesting a resolution to the issue. Feel free to reword if needed. Thanks 😄 --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 898d4cf..33cc4d5 100644 --- a/index.js +++ b/index.js @@ -36,7 +36,7 @@ export default class TableDragSelect extends React.Component { return; // Let error be handled elsewhere } const error = new Error( - "Invalid prop `children` supplied to `TableDragSelect`. Validation failed." + "Invalid prop `children` supplied to `TableDragSelect`. Validation failed.\n[Hint] Ensure the number of elements of the array passed to the `value` prop is equivalent to the number of cells passed as children." ); const trs = React.Children.toArray(props.children); const rowCount = props.value.length;