forked from extern/bruno
fix: fixed issue where 4xx errors were not being returned
This commit is contained in:
parent
ef9c6c493e
commit
6badca632b
@ -49,10 +49,27 @@ ipcMain.handle('grafnode-account-request', async (_, request) => {
|
||||
|
||||
// handler for sending http request
|
||||
ipcMain.handle('send-http-request', async (_, request) => {
|
||||
const result = await axios(request)
|
||||
return {
|
||||
status: result.status,
|
||||
headers: result.headers,
|
||||
data: result.data
|
||||
};
|
||||
try {
|
||||
const result = await axios(request);
|
||||
|
||||
return {
|
||||
status: result.status,
|
||||
headers: result.headers,
|
||||
data: result.data
|
||||
};
|
||||
} catch (error) {
|
||||
if(error.response) {
|
||||
return {
|
||||
status: error.response.status,
|
||||
headers: error.response.headers,
|
||||
data: error.response.data
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
status: -1,
|
||||
headers: [],
|
||||
data: null
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -28,7 +28,7 @@ const sendRequest = async (item, collectionUid, dispatch) => {
|
||||
itemUid: item.uid
|
||||
});
|
||||
})
|
||||
.catch((err) => console.log(err));
|
||||
.catch((err) => console.error(err));
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user