fix: catch rejected promise if it is in a try-catch block

This commit is contained in:
Hongbo Wu
2024-01-23 18:45:46 +08:00
parent 25603cf136
commit 8f5d4ae8a0
5 changed files with 6 additions and 6 deletions

View File

@ -95,7 +95,7 @@ const uploadToSignedUrl = async (
responseType: 'stream', responseType: 'stream',
timeout: REQUEST_TIMEOUT, timeout: REQUEST_TIMEOUT,
}) })
return axios.put(uploadSignedUrl, stream.data, { return await axios.put(uploadSignedUrl, stream.data, {
headers: { headers: {
'Content-Type': contentType, 'Content-Type': contentType,
}, },

View File

@ -112,7 +112,7 @@ const createHttpTaskWithToken = async ({
} }
try { try {
return client.createTask({ parent, task }) return await client.createTask({ parent, task })
} catch (error) { } catch (error) {
logError(error) logError(error)
return null return null

View File

@ -30,7 +30,7 @@ export const setLabels = async (
}) })
try { try {
return axios.post(`${apiEndpoint}/graphql`, data, { return await axios.post(`${apiEndpoint}/graphql`, data, {
headers: { headers: {
Cookie: `auth=${auth};`, Cookie: `auth=${auth};`,
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@ -29,7 +29,7 @@ export const sendNotification = async (
} }
try { try {
return axios.post(`${apiEndpoint}/notification/send`, requestData, { return await axios.post(`${apiEndpoint}/notification/send`, requestData, {
headers: { headers: {
Cookie: `auth=${auth};`, Cookie: `auth=${auth};`,
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@ -27,7 +27,7 @@ export const archivePage = async (
}) })
try { try {
return axios.post(`${apiEndpoint}/graphql`, data, { return await axios.post(`${apiEndpoint}/graphql`, data, {
headers: { headers: {
Cookie: `auth=${auth};`, Cookie: `auth=${auth};`,
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -66,7 +66,7 @@ export const markPageAsRead = async (
}) })
try { try {
return axios.post(`${apiEndpoint}/graphql`, data, { return await axios.post(`${apiEndpoint}/graphql`, data, {
headers: { headers: {
Cookie: `auth=${auth};`, Cookie: `auth=${auth};`,
'Content-Type': 'application/json', 'Content-Type': 'application/json',