answersLogoWhite

0


Best Answer

Yes. Use C# code as an example:

try {

int k = 100 / 0; // this will throw an exception

} catch (Exception e) {

throw new SystemException("Throwing a new exception because of "+ e.Message);

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can you throw exception from catch block in net?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is meant by error handling support in dot net?

The idiomatic way to express error conditions in .NET framework is by throwing exceptions. In C#, we can handle them using the try-catch-finally statement:try {// code which can throw exceptions}catch{// code executed only if exception was thrown}finally{// code executed whether an exception was thrown or not}Whenever an exception is thrown inside the try block, the execution continues in the catch block. The finallyblock executes after the try block has successfully completed. It also executes when exiting the catch block, either successfully or with an exception.In the catch block, we usually need information about the exception we are handling. To grab it, we use the following syntax:catch (Exception e) {// code can access exception details in variable e}The type used (Exception in our case), specifies which exceptions will be caught by the catch block (all in our case, as Exception is the base type of all exceptions).Any exceptions that are not of the given type or its descendants, will fall through.We can even add multiple catch blocks to a single try block. In this case, the exception will be caught by the first catch block with matching exception type:catch (FileNotFoundException e) {// code will only handle FileNotFoundException}catch (Exception e){// code will handle all the other exceptions}This allows us to handle different types of exceptions in different ways. We can recover from expected exceptions in a very specific way, for example:If a user selected a non-existing or invalid file, we can allow him to select a different file or cancel the action.If a network operation timed out, we can retry it or invite the user to check his network connectivity.For remaining unexpected exceptions, e.g. a NullReferenceExceptions caused by a bug in the code, we can show the user a generic error message, giving him an option to report the error, or log the error automatically without user intervention.


What do you do with a Nerf ball?

You can throw the ball in the air and catch it. If you have a net with your Nerf ball then you can throw the ball into the net. You can also pass the ball to another person and play catch.


What is the difference between throw and throw new in net?

an exception object must follow the throw statement. That exception object must be created by new-operator initially. One can throw the same exception instance again without creating a new one (throw new) later. Just for fun and as an example: Let's on purposely cause 2 operations to throw exception. A third method will determine which operation produce the shorter exception message length, and throw the shorter one. public void Operation1() { throw new SystemException("From Operation 1"); } public void Operation2() { throw new SystemException("From Op2"); } public void GetShorter() { SystemException e1; SystemException e2; try { Operation1(); } catch (Exception e) { e1 = e; } try { Operation2(); } catch (Exception e) { e2 = e; } if (e1.Message.Length < e2.Message.Length) { throw e1; // an example of not using new-operator } else { throw e2; } }


What is catch net?

When an exception occurs in program execution. Such as 1/0 or divide by zero exception. The program must catch the exception or the program will crash. Although handling of the exception or solution is not necessary.


How do you catch a batch of pigeons live?

You get a Net And Throw it at a Flock of Pigeons


What is the difference between throw and throws in net?

"throw" is the keyword to raise an exception. "throws" is a Java keyword that indicates a specific method can potentially raise a named exception. There is no analog in VB.Net or C#. Perhaps there is a "throws" keyword in J#?


What does a Jugs Instant Screen do?

The Jugs Instant Screen is a portable net meant to catch baseballs, softballs, soccerballs and more when you practice in a small space. The net will catch the ball and you can throw without having to worry about hitting something or someone.


Define gross block and net block?

Net block is the gross block less accumulated depreciation on assets. Net block is actually what the asset are worth to the company


What is the meaning of net as in fishing net?

it is the net you use to catch the fish in


What is a net?

a net is somthing to catch somthing with or trap


What is a dip net used to catch?

A dip net is used to catch bugs and butterflies! Hope I helped!


Where do you find the boulder to catch the fish on red dragon island?

You need the rotten fish from the Fortress steps to catch the Kappa fish. Go to the boat and "use" the fish. You will click on the frog to block the lily pad, the campfire to light the lantern, the beehive or hornet's nest to block the tree hole, and the rock to block the land opening. Place the fish on your net and there is only one way left for the Kappa to come after it...and you catch him.