mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Always throw error objects - never strings (#171498)
This commit is contained in:
parent
9523a78e7a
commit
4f9094caf3
4 changed files with 4 additions and 4 deletions
|
@ -10,7 +10,7 @@
|
|||
const isUsingNpm = process.env.npm_config_git !== undefined;
|
||||
|
||||
if (isUsingNpm) {
|
||||
throw `Use Yarn instead of npm, see Kibana's contributing guidelines`;
|
||||
throw new Error(`Use Yarn instead of npm, see Kibana's contributing guidelines`);
|
||||
}
|
||||
|
||||
// The value of the `npm_config_argv` env for each command:
|
||||
|
|
|
@ -266,7 +266,7 @@ function compileCondition(description, compiledObject) {
|
|||
return new RegExp(description.lines_regex, 'm').test(lines);
|
||||
}, compiledObject);
|
||||
} else {
|
||||
throw 'unknown condition type - got: ' + JSON.stringify(description);
|
||||
throw new Error(`unknown condition type - got: ${JSON.stringify(description)}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ export class ExplorerChartDistribution extends React.Component {
|
|||
.rangePoints([rowMargin, chartHeight - rowMargin])
|
||||
.domain(scaleCategories);
|
||||
} else {
|
||||
throw `chartType '${chartType}' not supported`;
|
||||
throw new Error(`chartType '${chartType}' not supported`);
|
||||
}
|
||||
|
||||
const yAxis = d3.svg
|
||||
|
|
|
@ -75,7 +75,7 @@ export default function ({ getService }) {
|
|||
try {
|
||||
panels = JSON.parse(resp.body.attributes.panelsJSON);
|
||||
} catch (error) {
|
||||
throw 'Unable to parse panelsJSON from dashboard saved object';
|
||||
throw new Error('Unable to parse panelsJSON from dashboard saved object');
|
||||
}
|
||||
expect(panels.length).to.be(1);
|
||||
expect(panels[0].type).to.be('map');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue