WebAssembly / wasi-crypto

WASI Cryptography API Proposal
162 stars 25 forks source link

ENOSYS alternatives #15

Closed jedisct1 closed 4 years ago

jedisct1 commented 4 years ago

Following Dan's insightful comment on PR#13, we can indeed replace ENOSYS (or equivalent) with a set of more informative codes.

Reviewing the current signature code and places where ENOSYS are currently used, I can see 4 different causes:

Does that list make sense?

Any other cases we should think about?

jedisct1 commented 4 years ago

Cases 2 is a good candidate for optional imports.

Other cases depend on function parameters, so these should probably return an error code.

If multiple related functions depend on a given optional capability, we can return either a relevant handle or one of the errors above.

jedisct1 commented 4 years ago

PR #14 was updated for this.