Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PnP does not throw error even though SharePoint returned error #1433

Closed
1 task done
rlv-dan opened this issue Mar 28, 2024 · 2 comments
Closed
1 task done

PnP does not throw error even though SharePoint returned error #1433

rlv-dan opened this issue Mar 28, 2024 · 2 comments
Assignees
Labels
area: model 📐 Related to the core SDK models

Comments

@rlv-dan
Copy link

rlv-dan commented Mar 28, 2024

Category

  • Bug

Describe the bug

I was writing code to update a listitem with await listItem.UpdateAsync(). Everything appeared to run fine, but the listitem in SharePoint was never updated. Using Fiddler I noticed that the response from SharePoint actually contained an error. Even though the response contained an error, the response code was actually 200 OK.

POST /sites/mysite/_api/web/lists/getbyid(guid'2089ed3d-88c9-4da4-bef5-f53cf1579c55')/items(57)/ValidateUpdateListItem HTTP/1.1

{
  "ErrorCode":-2146232832,
  "ErrorMessage":
  "Enter a date like this: 2/23/2012",
  "FieldName":"EdmDecEmploymentStartDate",
  "FieldValue":"test",
  "HasException":true,
  "ItemId":57
}

Obviously this was my fault for submitting the wrong date format, but I would expect that PnP throw an error here since the call actually failed.

Environment details (development & target environment)

  • SDK version: 1.12.0
  • Framework: ASP.NET Core 6
@jansenbe jansenbe self-assigned this Mar 30, 2024
@jansenbe jansenbe added the area: model 📐 Related to the core SDK models label Mar 30, 2024
@jansenbe
Copy link
Contributor

@rlv-dan : thanks for using PnP Core SDK and reporting this. Currently the response of the add call does check for possible exceptions, while update doesn't. I'll commit a fix for this in the coming days.

jansenbe added a commit that referenced this issue Apr 2, 2024
@jansenbe
Copy link
Contributor

jansenbe commented Apr 2, 2024

@rlv-dan : I've just pushed a change which will be part of the next nightly build. I'll close this issue now, but feel free re-open or create a new one in case the added functionality is not working for you.

@jansenbe jansenbe closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: model 📐 Related to the core SDK models
Projects
None yet
Development

No branches or pull requests

2 participants