Last active
June 9, 2021 03:17
-
-
Save zurgl/df4af65d85cae2a59e4c1fba27ca28fa to your computer and use it in GitHub Desktop.
Revisions
-
zurgl revised this gist
Jun 9, 2021 . 1 changed file with 12 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,23 @@ [here](https://www.youtube.com/watch?v=ITogH7lJTyE) Standardize error handling ```js async function awesome() { try { const data = await promise; return [data, null] } catch(error) { console.error(error) return [null, error]; } } ``` Using it ```js async function main() { const [data1, error] = await awesome(); const [data2, error] = await awesome(); // #- ... } ``` -
zurgl revised this gist
Jun 9, 2021 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,11 +5,11 @@ standardize error handling ```js async function awesome() { try { const data = await promise; return [data, null] } catch(error) { console.error(error) return [null, error]; } } ``` -
zurgl created this gist
Jun 9, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ [here](https://www.youtube.com/watch?v=ITogH7lJTyE) standardize error handling ```js async function awesome() { try { const data = await promise; return [data, null] } catch(error) { console.error(error) return [null, error]; } } ``` using it ```js async function main() { const [data1, error] = await awesome(); const [data2, error] = await awesome(); ... } ```