Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

try without catch

/*
It's possible to have an empty catch block, 
without an error variable, starting with ES2019. 
This is called optional catch binding and was implemented in V8 v6.6, 
released in June 2018. 
The feature has been available since Node 10, Chrome 66, Firefox 58, Opera 53 and Safari 11.1.

The syntax is shown below:
*/
try {
  throw new Error("This won't show anything");
} catch { };

/*

You still need a catch block, but it can be empty and you don't need to pass any variable. 
If you don't want a catch block at all, you can use the try/finally, 
but note that it won't swallow errors as an empty catch does.
*/
try {
  throw new Error("This WILL get logged");
} finally {
  console.log("This syntax does not swallow errors");
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: check if javascript function is true 
Javascript :: object initializer in javascript 
Javascript :: js str split 
Javascript :: passport middleware check if authenticated 
Javascript :: js detect end of array 
Javascript :: react native image swiper 
Javascript :: how to print a list in javascript 
Javascript :: loop foreach async await 
Javascript :: Use the parseInt Function with a Radix Javascript 
Javascript :: react rating 
Javascript :: delete item from array of objects javascript 
Javascript :: react native time range picker 
Javascript :: queryselector multiple attributes 
Javascript :: node.js global variables 
Javascript :: react onclick remove component 
Javascript :: react navigation 4 
Javascript :: fibonacci series javascript using recursion explanation 
Javascript :: javascript map() method 
Javascript :: react native charts 
Javascript :: serviceworker in angular 
Javascript :: object constructor js 
Javascript :: Graph pie 
Javascript :: vuejs chatbot widget 
Javascript :: how to return when child process is complete in node js 
Javascript :: aws lambda function setup for node js 
Javascript :: discord.js vs discord.py 
Javascript :: discord bot not responding to commands 
Javascript :: heap javascript 
Javascript :: how to remove first element of array in javascript 
Javascript :: passport local 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =