#error-handling 14 articles
"0 sent" hides whether anyone was even asked — boolean mail wrappers conflate refusal with an empty audience gotchas / graph The recipient side of the same trap: a denied group read becomes an empty audience, an empty audience becomes a benign false, and an approval queue notifies nobody "File is missing" and "I cannot read the file" collapse into the same null — and the empty state then lies gotchas / rest-api A T | null helper folds 404, 403, 500 and network failure into one null, and the friendly empty state then lies to the one user who has overdue work; return {ok, status, data} and let only 404 (on every candidate path)… AddValidateUpdateItemUsingPath answers 200 when it creates nothing — while a write to a missing column is a loud 400 gotchas / rest-api Field errors sit inside a 200 and no item is created; a write to a missing column is a 400 on every path, never a silent drop Promise.all discards the soft reads it was waiting for — one failing main read leaves every picker loading forever gotchas / spfx A failing main read rejects the batch and the soft reads' results and failure flags never reach the pickers; settle each read on its own $ErrorActionPreference = 'Stop' turns a native command's stderr warning into a terminating error gotchas / powershell $ErrorActionPreference='Stop' escalates a benign stderr warning (exit 0) to a script-killer; wrap in 'Continue', judge by $LASTEXITCODE A deleted site and a site you cannot see are two different answers — read the status, not ok gotchas / rest-api _api/web on a non-existent site collection answers 404 (measured, no redirect), so if (!r.ok) return unknown makes a dead row in your own site inventory look like a site you merely lack permission on; keep r.status… A mailto: fallback that reuses the success state tells the user their message was sent when it wasn't gotchas / graph sendMail fails on accounts without a mailbox and the fallback only hands a draft to a mail client; model sent / handed off / failed, never a boolean A missing attachment returns 400, not 404 – an "is it there?" check by status code reads "not there" as a failure gotchas / rest-api AttachmentFiles('name') on a missing attachment returns 400 ArgumentOutOfRangeException; check existence from the attachment list A module-level cached dynamic import() caches the rejection too gotchas / spfx One chunk-load blip poisons the module-level promise for the whole session; reset it to null in .catch so the next call retries A silently-failed read turns reconciliation into delete-everything gotchas / rest-api A quiet if (!ok) break turns "sync what changed" into "delete everything"; fail-safe for a view means show what you can, for a delete it means do nothing moveto succeeds and your code reports a failure — action endpoints return an empty body gotchas / rest-api Action endpoints (moveto, removebyid) return an empty body, so response.json() throws after the operation happened and invites a retry; decide by status, parse only what you read Read all items from a large list — paging done right snippets / rest Any list past a few thousand items: $top caps at 5,000, $skip is ignored — follow odata.nextLink. Plus the error branch: break returns a partial list that looks complete Retrying a write without the "new" columns on any 400 silently loses data — drop only the column the error names gotchas / rest-api When one new column is missing, a group-wide retry drops the ones that exist too; drop only the fields the error names as not existing, loop, and tell the user what was left out Search REST returns 500 "unknown error" and 429 "low resources" for minutes at a time — retry the read, don't fix the query gotchas / search SharePoint Search REST can fail for a few minutes with HTTP 500 SearchServiceException (no Retry-After) and HTTP 429 low-resources errors; the same query succeeds seconds later, so retry reads briefly with a fixed…