spinframework / spinframework/spin

Opaque errors at times returned from the SDKs

Open
#1,362 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
6.5k
Forks
310
Avg merge
1d 20h
Merged PRs (30d)
24

Description

We're usually directly forwarding errors that have been created by wit-bindgen from SDK APIs. This can lead to errors that are less than ideal and only offer the minimal amount of information to the user.

For example, calling key_value::Store::open when the spin.toml manifest does not contain a key_value_stores key for the component simply displays the following:

Handler returned an error: Error::AccessDenied

If the user is unfamiliar with the key_value feature, they have absolutely no idea that this error means that they do not have any allowed stores configured. Ideally we would show something like the following:

Handler returned an error: Error::AccessDenied

Note: Are you sure you've included a list of allowed key_value_stores in your spin.toml? 
Make sure to add the `key_value_stores` key to your component and specify which key value stores you'd like to allow. 

For example, `key_value_stores = ["default"]` allows the default key value store.  

Unfortunately, each SDK would have to handle this themselves. The Rust SDK could do this by making the Display implementation more sophisticated than it currently is. However, to make it really nice where we have configurable "verbosity" of error reporting, we'd likely want a bespoke trait that extends std::error::Error and provides additional features.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Rust SDK's Display implementation and the error returned by key_value::Store::open. Determine how SDK errors should expose the missing key_value_stores configuration and what configurable verbosity or additional error behavior is required; done should provide more useful context than the opaque AccessDenied message.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.