Skip to content

Commit

Permalink
sonar fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rishikunnath2747 committed Jan 16, 2025
1 parent 125e415 commit bc83384
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/handler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@ const axios = require("axios").default;
const FormData = require("form-data");

async function readAttachment(Key, token, credentials) {
try {
const document = await readDocument(Key, token, credentials.uri);
return document;
} catch (error) {
throw error;
}
const document = await readDocument(Key, token, credentials.uri);
return document;
}

async function readDocument(Key, token, uri) {
Expand All @@ -30,7 +26,7 @@ async function readDocument(Key, token, uri) {
const responseBuffer = Buffer.from(response.data, "binary");
return responseBuffer;
} catch (error) {
if (error.message = "Error: AxiosError: Request failed with status code 404" && error.status == 404){
if (error.message == "Error: AxiosError: Request failed with status code 404" && error.status == 404){
error.message = "Attachment not found in the repository"
}
error.code = error.status
Expand Down

0 comments on commit bc83384

Please sign in to comment.