Internal apps fail in ordinary ways. A required field is blank. Someone tries to approve a request that was already rejected. The email to the next person does not send. The save button spins and then paints a stack trace across the screen.
The stack trace is for you. The person at the desk needs a sentence they can act on. If they do not get one, they will screenshot the mess, email it to you, and keep a side copy in Excel so they can finish the day. That is how a working app becomes a system people route around.
## Say What Happened and What to Do
A useful error has two parts. What the system refused, and the next step that is actually available.
- “Plant is required.”
- “This request was already approved by Jordan at 2:14. Refresh to see the current status.”
- “You can edit drafts. Approval sits with a manager. Ask your supervisor, or send it back to the queue.”
- “We saved the request, but the notification email did not send. The approver will not see it in their inbox until you resend.”
“Something went wrong” is what you show when you truly do not know. It should be rare. It should include a time and a short reference id so the person can tell you which failure they hit, and so you can find it in the log without a scavenger hunt.
## Catch It Before the Database Does
Prisma and the database will happily be the last line of defense. They should not be the first voice the user hears.
Required fields, number ranges, and “this status is not a legal next step” belong in the same service function that performs the change. That is the same place I put permission checks and audit writes. If the rule lives there, the message can be specific. If the rule lives only in a NOT NULL constraint, the user gets a driver error and you get a ticket.
Validate on the way in. Let the database keep the promise. Do not make the user translate Unique constraint failed on the fields: (requestNumber).
## Workflow Conflicts Are Not Bugs
Two people will open the same request. One will approve it. The other will try to reject it a minute later. That is not an exception to be ashamed of. It is the job.
The second save should fail cleanly. Tell them the status changed, who changed it if your audit trail knows, and reload the record. Do not overwrite the first decision because the form they had open was stale.
Illegal transitions deserve the same tone. “Rejected requests cannot be approved. Reopen it first.” is a lesson about the process. A 500 is a lesson that the app is fragile.
## Permission Errors Should Point at a Person
A bare 403 trains people to ask for admin. The message can stay short and still be useful: you cannot do this action, and here is the role that can.
Do not list every permission you checked. Do not explain the Entra group name unless the user is an admin who can actually fix membership. “Only approvers can move this to Approved” is enough. If the business has a named queue or a supervisor, mention that.
And never confirm the existence of a record the person is not allowed to see by returning a detailed error for it. Not found, or not allowed, with the same calm sentence, is safer than a message that says the vendor cost is hidden.
## When the Failure Is Outside the App
Email, file storage, and the identity provider will fail on their own schedule. I have written about Graph versus SMTP because those failures used to show up as a bounce three hours later, if they showed up at all.
Split the work. Saving the business record and sending the notification are related, but they are not the same transaction if the notification can fail after the save succeeded. If the request is approved and the mail did not go out, say that. Offer a resend. Log the Graph error code for yourself. Do not roll back an approval the business already considers done just because a mailbox throttled you.
If you cannot tell those cases apart, every outage looks like data loss, and every data loss looks like an outage.
## Empty Is Not an Error
A new user with no requests is not a failure. A filter that matches nothing is not a failure. A queue that is caught up is the system working.
Those screens still need a sentence. “Nothing is waiting on you.” “No requests match this plant.” Leave the red banner for things that need a human to act. I covered the filter side of this in search that replaces Ctrl+F. The same idea applies to the rest of the app: quiet success should look quiet.
## Log for You, Speak for Them
The user message and the log line are different artifacts. The message is short, specific, and free of connection strings, SQL, and file paths. The log has the error name, the record id, the user id, and the upstream status code.
You do not need an observability platform to start. You do need the habit. When a save fails for a reason the user cannot fix, you should be able to find that event without asking them to reproduce it from memory.
Do not put secrets in either place. Tokens, passwords, and raw mailbox payloads do not belong in the toast or in the log you might forward to a vendor.
## Final Thought
An internal app is a coworker people depend on. When it cannot do something, it should say so in the language of the work: this field, this status, this permission, this email.
Stack traces build your understanding. Plain sentences build theirs. Ship the sentences.