Skip to content

Instantly share code, notes, and snippets.

View bowser_refactoring_example.js
import Utils from './utils.js';
const browsersNames = [
/* Googlebot */
{
test: [/googlebot/i],
name: 'Googlebot',
},
];
@Kiura
Kiura / addition_to_Go2_draft_error_handling.md
Created Sep 26, 2018
Kiura Magomadov "Addition to Go2 draft error handling" September 2018
View addition_to_Go2_draft_error_handling.md

This is just another way to deal with errors following Go2 draft structure.

If I understood correctly handle is used as defer in many proposals, which, could be a drawback in case we want the function to fail as soon as error occurs. So, a better scenario could be as follows:

  1. Unhandled error occurs - it is thrown and parent function should handle it
  2. Handled error occurs - handle function catches it and performs some operations before exiting the function (in the handle function one can decide to throw an error again if he/she needs to add additional info to the err)
View genesis_public_key
046469ed796906337e5d3967d60f89bae980e7bff35e5b4ffec73e2f1d033de2efe7993ca0d9262a25c16845dea0955c043ad6ff465dec7873776472b46515aad6 rbatukaev