Skip to content
Nuvexa AI
Menu
Coding · PRACTICAL TUTORIAL

Show a useful error without exposing provider internals

A useful error explains the next action. Provider credentials, internal paths and unrelated diagnostics do not belong in public responses.

Published by Nuvexa AI · Published · 2 min read

Start here

This example uses the sample details below. Replace them with your own facts before applying the instructions.

  • Upstream failure includes stack text and request headers.

Start with the facts

Upstream failure includes stack text and request headers. Keep a small reproducible example and the expected behavior. Remove secrets from the code or error message before requesting help.

Spot the problem

The wording or action to avoid is: “Return the raw provider response to every user.” A useful error explains the next action. Provider credentials, internal paths and unrelated diagnostics do not belong in public responses.

Make the correction

Show a clear retry or input message while retaining necessary diagnostic information in protected logs.

Check before using the result

Trigger a controlled failure and inspect both the browser response and protected logs for accidental secret disclosure.

Worked example and reusable input

Use the stated inputs to reproduce checked local outputs. Replace sample facts when applying a brief to your own work.

TASK
Show a useful error without exposing provider internals

SAMPLE INPUT — replace with your actual facts
Upstream failure includes stack text and request headers.

AVOID
Return the raw provider response to every user.

CORRECTED APPROACH
Show a clear retry or input message while retaining necessary diagnostic information in protected logs.

ACCEPTANCE CHECK
Trigger a controlled failure and inspect both the browser response and protected logs for accidental secret disclosure.

Key takeaways

  • A useful error explains the next action. Provider credentials, internal paths and unrelated diagnostics do not belong in public responses.
  • Trigger a controlled failure and inspect both the browser response and protected logs for accidental secret disclosure.