api 호출 후 에러 발생시 오류 메시지 문의


api 시 WebException

catch 서 api 떄 alert
??




api, 련 api .


try{
string url = string.Format(TOSS_PAYMENT_CANCEL_URL_FORMAT, reqData.PaymentKey);
} catch (WebException ex)
{
string errorMsg = OrderCommon.GetWebExceptionMessage(ex);
}

public static string GetWebExceptionMessage(WebException ex)
{
if (ex.Response == null)
return ex.ToString();

using (StreamReader reader = new StreamReader(ex.Response.GetResponseStream()))
{
return reader.ReadToEnd();
}
}

.
Was this page helpful?