public int Divide(int x, int y) { if (y == 0) throw new ArgumentOutOfRangeException(); return x / y; } public void DoSomething() { try { var x = 1; var y = 0; // this is the interface for obtaining the normal result type var r = Divide(x, y); Console.WriteLine("Result: {0}", r); } // this is the interface for obtaining the erroneuous result type catch (ArgumentOutOfRangeException) { Console.WriteLine("Error"); throw; } }