mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-03-30 06:29:09 +01:00
Log errors
This commit is contained in:
parent
16bb03c47c
commit
54cd7a32d8
@ -1,7 +1,11 @@
|
||||
import * as Logger from "../Common/Logger";
|
||||
|
||||
export function validateEndpoint(endpointToValidate: string | undefined, allowedEndpoints: string[]): boolean {
|
||||
try {
|
||||
return validateEndpointInternal(endpointToValidate, allowedEndpoints);
|
||||
} catch {
|
||||
} catch (reason) {
|
||||
Logger.logError(`${endpointToValidate} not allowed`, "validateEndpoint");
|
||||
Logger.logError(`${JSON.stringify(reason)}`, "validateEndpoint");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -16,7 +20,9 @@ function validateEndpointInternal(endpointToValidate: string | undefined, allowe
|
||||
const valid = allowedOrigins.indexOf(originToValidate) >= 0;
|
||||
|
||||
if (!valid) {
|
||||
console.error(`${endpointToValidate} not allowed`);
|
||||
throw new Error(
|
||||
`${endpointToValidate} is not an allowed endpoint. Allowed endpoints are ${allowedArmEndpoints.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
return valid;
|
||||
|
Loading…
x
Reference in New Issue
Block a user