Вот как я бросаю исключение: < /p>
throw RestExceptionHandler.ThrowException(ErrorCode.WebServiceConnectorUnableToGetUser);
Это метод throwexception :
public static RestServerException ThrowException(ErrorCode errorCode, object[] parameters = null, string property = null)
{
try
{
var value = ErrorCodes.errorList.First(code => code.errorCode == errorCode);
if (parameters?.Length > 0)
{
return new RestServerException(string.Format(value.description, parameters),
value.httpStatusCode, new ErrorDescription
{
property = property ?? value.property,
errorCode = value.errorCode
});
}
value.description = value.description.Replace("'{0}'", "");//removing placeholder {0} if there are no parameters given
return new RestServerException(value.description,
value.httpStatusCode, new ErrorDescription
{
property = property ?? value.property,
errorCode = value.errorCode
});
}
catch (Exception e)
{
Log.Error(e, "Error: {@Exception}", e);
throw;
}
}
Это тело ошибки исключения:
Теперь приходит код React, это пост -функция в моей службе:
getUser(request: any) {
const res = axios
.post("https://localhost:5002/v/1/signumid_integrations/user", request)
.then((res) => {
console.log(res);
return res.data;
})
.catch(function (err) {
console.log(err);
});
return res;
}
И вот как я называю метод GetUser :
httpClient
.getUser(request)
.then((res2) => {
initiator.current =
res2.mail === null || res2.mail === undefined || res2.mail === "" ? res2.userPrincipalName : res2.mail;
});
< /code>
И это ошибка Axios, которую я получаю каждый раз. Это пустая сетевая ошибка по умолчанию. до 400.app.MapPost("v/1/signumid_integrations/user", async (ExchangeOBORequest request) =>
await IntegrationsService.GetUser(request));
Подробнее здесь: https://stackoverflow.com/questions/738 ... ios-in-rea