When the server refuses an action
The backend enforces every limit itself. The package undoes what it drew early and shows the server's message - nothing to wire up.
Overview
Whatever the UI shows, the server enforces every limit. When it refuses something, the package undoes exactly what it had drawn early and shows the server's message (which already contains the number).
What the user sees
How the right message is rolled back
Each send carries a tempId, and the server names it when it refuses, so the right message is rolled back even when several are in flight. File sizes are checked when the upload link is requested (fileSize), before any upload.
Read the code and message of any failed package API call with getApiErrorCode(err) / getApiErrorMessage(err, fallback).