You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letcells: Cell[]// = ...try{constresp=awaitupdateDashboardCells({dashboardID: 123,body: cells})console.log("updated cells",resp.data)// resp.data of type `Cell[]`}catch(error){if(error.response){// ⚠️ `error.response` is of type `any`, and it is impossible to specify it// otherwise. But this is where we would handle non-2xx responses that have// a schema in the OpenAPI specif(error.response.status===404){notify(error.response.data)}else{reportErrorToHoneyBadger(error.response.data)}}elseif(axios.isCancel(error){return// request was canceled}else{reportErrorToHoneyBadger(error)}}
Option 2: Axios or fetch with custom wrapper
Error path is typed
Unfamiliar compared to our current style
letcells: Cell[]// = ...try{constresp=awaitupdateDashboardCells({dashboardID: 123,body: cells})if(resp.status===200){console.log("updated cells",resp.data)// resp.data of type `Cell[]`}elseif(resp.status===404){notify(resp.data.message)// resp.data.message of type `string`}else{reportErrorToHoneyBadger(resp.data)// resp.data of type `DefaultError`}}catch(error){if(error.name==='AbortError'){return// request was cancelled}reportErrorToHoneyBadger(error)}