Skip to content

Commit

Permalink
fix: add debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhKumar05 committed May 27, 2024
1 parent 72c4d5c commit 4f451b2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions nodejs/src/services/APIService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export default class APIService {
};
return config;
},
(error) => Promise.reject(error)
(error) => {
logger.error(error);
return Promise.reject(error)
}
);
this.axios.interceptors.response.use(
(response) => {
Expand All @@ -77,7 +80,9 @@ export default class APIService {
});
this.axios.defaults.headers.common["Authorization"] = "Bearer " + authToken;
try {
return this.axios(originalRequest);
const resp = this.axios(originalRequest);
logger.debug("Response", resp)
return resp;
} catch (error) {
throw this.convertAxiosErrorToHMS(error as AxiosError);
}
Expand All @@ -88,6 +93,7 @@ export default class APIService {
}

private convertAxiosErrorToHMS(error: AxiosError) {
logger.error(error);
return ErrorFactory.MakeError(
error.response?.status,
error.response?.statusText,
Expand Down
5 changes: 4 additions & 1 deletion nodejs/src/services/AuthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export default class AuthService {
!this.managementToken ||
this.isTokenExpired(this.managementToken.token)
) {
logger.debug("Generating management token", tokenConfig);
logger.debug("Generating management token");
if(tokenConfig){
logger.debug("TokenConfig:", tokenConfig)
}
this.managementToken = await this.generateToken(TokenType.Management, tokenConfig);
}
return this.managementToken;
Expand Down

0 comments on commit 4f451b2

Please sign in to comment.