Skip to content

Commit

Permalink
docs: Clarify terminating client requests with Rhai exception must be…
Browse files Browse the repository at this point in the history
… thrown from supergraph (#5934)
  • Loading branch information
shorgi authored Sep 2, 2024
1 parent f3fd8f6 commit 2a3e289
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/source/customizations/rhai-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ log_trace("trace-level log message");

## Terminating client requests

Your Rhai script can terminate the associated client request that triggered it. To do so, it throws an exception. This returns an `Internal Server Error` to the client with a `500` response code.
Your Rhai script can terminate the associated client request that triggered it. To do so, it must throw an exception from the supergraph service. This returns an `Internal Server Error` to the client with a `500` response code.

For example:
```rhai
// Must throw exception from supergraph service
fn supergraph_service(service) {
// Define a closure to process our response
let f = |response| {
Expand All @@ -75,6 +76,7 @@ The key must be a number and the message must be something which can be converte

For example:
```rhai
// Must throw exception from supergraph service
fn supergraph_service(service) {
// Define a closure to process our response
let f = |response| {
Expand All @@ -93,6 +95,7 @@ You can also `throw` a valid GraphQL response, which will be deserialized and de

For example:
```rhai
// Must throw exception from supergraph service
fn supergraph_service(service) {
// Define a closure to process our request
let f = |request| {
Expand Down

0 comments on commit 2a3e289

Please sign in to comment.