CJCoding With Joseph

Exception Filter With when

Read an integer status code. If it is >= 400, throw new Exception(code.ToString()); otherwise print Success. Use an exception filter: catch (Exception ex) when (ex.Message == "404") prints Not Found, and a second catch (Exception) prints Other error. Use top-level statements.

Input 200 prints: Success
Input 404 prints: Not Found
Input 500 prints: Other error

Expected Output:

Success
Topics:
Exceptions
๐Ÿ“ฅ Auto-Input:
200\n
This input is automatically fed to your program's stdin
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.