mirror of https://github.com/embarklabs/embark.git
chore(core/utils): better error handling when invalid blockchain `endpoint` is defined
This commit is contained in:
parent
deb682c9d2
commit
ae56575554
|
@ -181,6 +181,9 @@ export function toposort(graph) {
|
||||||
|
|
||||||
export function deconstructUrl(endpoint) {
|
export function deconstructUrl(endpoint) {
|
||||||
const matches = endpoint.match(/(wss?|https?):\/\/([a-zA-Z0-9_.\/-]*):?([0-9]*)?/);
|
const matches = endpoint.match(/(wss?|https?):\/\/([a-zA-Z0-9_.\/-]*):?([0-9]*)?/);
|
||||||
|
if (!matches) {
|
||||||
|
throw new Error(`Couldn't deconstruct blockchain endpoint which needs to be a URL. Got '${endpoint}`);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
protocol: matches[1],
|
protocol: matches[1],
|
||||||
host: matches[2],
|
host: matches[2],
|
||||||
|
|
Loading…
Reference in New Issue