Skip to content

Commit

Permalink
Lower BufferLengthError's log level to DEBUG
Browse files Browse the repository at this point in the history
`BufferLengthError` is a sentinel error used to indicate to the caller that the passed in buffer was [too small](https://github.com/fastly/Viceroy/blob/f62eb94c470f39df1d25cba3ffb028a3289bbf15/lib/src/wiggle_abi/secret_store_impl.rs#L110-L113). The caller can then try again with an appropriately sized buffer.

The Fastly CLI executes Viceroy with a [`-v`](https://github.com/fastly/cli/blob/24761dcccd81d16e3873c1fa65e03fd83486442f/pkg/commands/compute/serve.go#L534) argument, which corresponds to `INFO` log level. This change drops the log level of `BufferLengthError` errors to `DEBUG`, so that they're not displayed to users running apps via `fastly compute serve`.
  • Loading branch information
awilliams-fastly committed Sep 25, 2023
1 parent f62eb94 commit 45f4914
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/src/wiggle_abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ impl UserErrorConversion for Session {
event!(Level::DEBUG, "Hostcall yielded an error: {}", err);
}
},
Error::BufferLengthError { .. } => {
event!(Level::DEBUG, "Hostcall yielded an error: {}", e)
}
_ => event!(Level::ERROR, "Hostcall yielded an error: {}", e),
}

Expand Down

0 comments on commit 45f4914

Please sign in to comment.