fix: add accurate error message when user input invalid service name or method name
This commit is contained in:
parent
4147a4c404
commit
d111db0321
|
@ -778,6 +778,7 @@ module.exports.grpcQuery = async (options) => {
|
||||||
cb);
|
cb);
|
||||||
}, false, false);
|
}, false, false);
|
||||||
return new Promise((resolve, _) => {
|
return new Promise((resolve, _) => {
|
||||||
|
try {
|
||||||
return grpcService[`${grpcMethod}`](JSON.parse(grpcBody), function (err, response) {
|
return grpcService[`${grpcMethod}`](JSON.parse(grpcBody), function (err, response) {
|
||||||
const responseData = JSON.stringify(response);
|
const responseData = JSON.stringify(response);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -795,5 +796,13 @@ module.exports.grpcQuery = async (options) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} catch (err) {
|
||||||
|
return resolve({
|
||||||
|
code: -1,
|
||||||
|
errorMessage: `Error ${err}. Please review your gRPC configuration option. The service name must not include package name value, and the method name must follow camelCase format`,
|
||||||
|
data: ""
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue