address error.responseBody is undefined
When confirming on the user input step, this error is thrown: `TypeError: error.responseBody is undefinedjenkins-js-extension.js:95465:21`.
This code should handle an error in the case that there is no `responseBody` in the `error` object.
@@ -88,10 +88,14 @@ export default class InputStep extends Component {
const parameters = this.parameterService.parametersToSubmitArray();
parameterApi.submitInputParameter(href, id, parameters).catch(error => {
- if (error.responseBody.message) {
+ if (error.responseBody && error.responseBody.message) {
this.setState({
responseErrorMsg: error.responseBody.message,
});
+ } else if (error) {
+ this.setState({
+ responseErrorMsg: error.message,
+ });
}
});
}
