Skip to content

Commit

Permalink
fixed type check and extended error message for invalid URL
Browse files Browse the repository at this point in the history
  • Loading branch information
YulNaumenko committed Jun 30, 2020
1 parent e725ed9 commit f3c998a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('config validation', () => {
expect(() => {
validateConfig(actionType, config);
}).toThrowErrorMatchingInlineSnapshot(
'"error validating action type config: error configuring webhook action: unable to parse host name from Url"'
'"error validating action type config: error configuring webhook action: unable to parse url: TypeError: Invalid URL: example.com/do-something"'
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function validateActionTypeConfig(
url = new URL(configObject.url);
} catch (err) {
return i18n.translate('xpack.actions.builtin.webhook.webhookConfigurationErrorNoHostname', {
defaultMessage: 'error configuring webhook action: unable to parse host name from Url',
defaultMessage: `error configuring webhook action: unable to parse url: ${err}`,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { constant, isEmpty } from 'lodash';
import { constant } from 'lodash';

export function throwIfAbsent<T>(message: string) {
return (value: T | undefined): T => {
Expand Down

0 comments on commit f3c998a

Please sign in to comment.