แก้ throw error
This commit is contained in:
parent
86a5cd7fb5
commit
e251b16c11
2 changed files with 54 additions and 44 deletions
|
|
@ -189,12 +189,12 @@ class CheckAuth {
|
|||
port: process.env.REDIS_PORT,
|
||||
});
|
||||
const getAsync = promisify(redisClient.get).bind(redisClient);
|
||||
let reply = await getAsync("org_" + keycloakId);
|
||||
if (reply != null) {
|
||||
reply = JSON.parse(reply);
|
||||
} else {
|
||||
if (!keycloakId) throw "Error calling API No KeycloakId";
|
||||
try {
|
||||
try {
|
||||
let reply = await getAsync("org_" + keycloakId);
|
||||
if (reply != null) {
|
||||
reply = JSON.parse(reply);
|
||||
} else {
|
||||
if (!keycloakId) throw new Error("No KeycloakId provided");
|
||||
const x = await new CallAPI().GetData(
|
||||
{
|
||||
headers: { authorization: token },
|
||||
|
|
@ -212,10 +212,10 @@ class CheckAuth {
|
|||
};
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error("Error calling API:", error);
|
||||
throw error;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error calling API:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
public async PermissionCreate(req: RequestWithUser, system: string) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue