Skip to content

Instantly share code, notes, and snippets.

@alperencapar
alperencapar / async-await-es7-error-handling.js
Created August 22, 2020 08:19
Javascript ES7 Async Await Error Handling
class Request{
//HTTP response status codes: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
async delete(url){
const deleteResponse = await fetch(url,{
method: "DELETE"
})//Continues only after the promise has resolved
//Since our method is deleting data