0
:Angular2와 낸시 : 처리 오류 메시지 나 각도 2.</p> <p>내 낸시 서버 코드를 기반으로 웹 응용 프로그램에 낸시 오류 메시지에서 반환하려고
private dynamic GetSolution(dynamic arg)
{
string solutionName = arg.name;
if (solutionName == "error")
{
var response = Json(new {message = $"error"});
response.StatusCode = HttpStatusCode.BadRequest;
return response;
}
return Json(solutionService.GetSolutionByName(solutionName));
}
클라이언트 측에서 다음과 프로세스 응답 코드 :
onButtonClicked(name: string): void
{
this
.solutionsService
.getSolutionByName(name)
.subscribe(
p=>this.showMessage(p.title),
p=>this.showError(p.message));
//this.refresh(true);
}
상태 (200) reponse는 경우 - 내가 예상 오브젝트 (필드 ID와 제목 솔루션을)받을
하지만 상태 코드 0 오류 (예 : 400) 내가 예상치 못한 개체를 얻을 경우 : 내가 잘못된 일을
?