[No.1] SubmitChanged 에서의 Error 처리 방법

in #dev7 years ago (edited)

스티밋을 하면서 무엇을 쓸까 고민하다.
결국 주제를 찾지 못해 작업하다 필요에 의해 정리해 두었던 내용들을 하나씩 올려볼까 합니다.

DomainService 객체의 SubmitChange시 오류처리 로직

[source]

_DoS.SubmitChanges().Completed += (s1, e1) =>
{
SubmitOperation so = s1 as SubmitOperation;
if (!so.HasError)
{
// 정상적인 로직처리
}
else
{
// 유효성 검사에 문제가 있을때 세부 메시지 내용을 리포팅 해주는 코드
// 유효성 검사 외의 다른 오류처리기능 추가되어야함
string Message = "";

  foreach (var Entity in so.EntitiesInError)
  {
    foreach (var Validation in Entity.ValidationErrors)
      Message += Entity.GetType().ToString() + " " + Validation.ErrorMessage + "\n";
  }

  if (Message != "")
  {
    MessageBox.Show("이 에러메세지를 캡처하여 개발담당자에게 꼭 전달해 주세요\n" + Message);
    so.MarkErrorAsHandled();
  }

}

};

Sort:  

Congratulations @love4yj! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You got your First payout

Click on any badge to view your own Board of Honnor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Congratulations @love4yj! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.16
TRX 0.17
JST 0.029
BTC 69641.68
ETH 2498.43
USDT 1.00
SBD 2.56