Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static getCanonicalCode(err: Error) {
if (Spanner.isRestError(err)) {
switch (err.statusCode) {
case 401:
return CanonicalCode.PERMISSION_DENIED;
case 404:
return CanonicalCode.NOT_FOUND;
case 412:
return CanonicalCode.FAILED_PRECONDITION;
}
}
return CanonicalCode.UNKNOWN;
}