컴파일러 오류 CS0156
업데이트: 2007년 11월
오류 메시지
바로 바깥쪽 catch 절에 중첩된 finally 절에는 인수가 없는 throw 문을 사용할 수 없습니다.
A throw statement with no arguments is not allowed in a finally clause that is nested inside the nearest enclosing catch clause
매개 변수가 없는 throw 문은 매개 변수를 받지 않는 catch 절에서만 사용할 수 있습니다.
자세한 내용은 예외 처리문 및 예외 및 예외 처리(C# 프로그래밍 가이드)를 참조하십시오.
다음 샘플에서는 CS0156 오류가 발생하는 경우를 보여 줍니다.
// CS0156.cs
using System;
namespace MyNamespace
{
public class MyClass2 : Exception
{
}
public class MyClass
{
public static void Main()
{
try
{
throw; // CS0156
}
catch(MyClass2)
{
throw; // this throw is valid
}
}
}
}