MCPcopy Create free account
hub / github.com/3rfaan/courses / Process1

Function Process1

C#/ThrowExceptions101/Program.cs:38–57  ·  view source on GitHub ↗
(String[] userEntries)

Source from the content-addressed store, hash-verified

36}
37
38static void Process1(String[] userEntries)
39{
40 int valueEntered;
41
42 foreach (string userValue in userEntries)
43 {
44 bool integerFormat = int.TryParse(userValue, out valueEntered);
45
46 if (integerFormat)
47 if (valueEntered != 0)
48 checked
49 {
50 int calculatedValue = 4 / valueEntered;
51 }
52 else
53 throw new DivideByZeroException("Invalid data. User input values must be non-zero values.");
54 else
55 throw new FormatException("Invalid data. User input values must be valid integers.");
56 }
57}

Callers 1

Workflow1Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected