Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement WASI error-handling #152

Merged
merged 1 commit into from
Sep 6, 2023
Merged

Conversation

kulcsaradam
Copy link
Contributor

https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md#-errno-variant

Implement simple error-handling according to WASI documentation where functions return an error code as their first result and after that their usual results.

namespace Walrus {

std::string WASI::m_wasiErrorMessage[WASI::wasi_errno::notcapable + 1];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this string list is not used at all.
Would it be used later?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to use it to somehow communicate errors to the users of these functions, but I was unsure how you would like this part of wasi, so for the time being I left it it. It contains all the error messages in pairs with the error codes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

walrus aims to be a lightweight WASM engine for resource-limited devices.
So, allocating a global array just for error messages does not fit in our goal.
If you really need this array, please use it with debug mode only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed the global array, but left in the messages without any storage, in case we would like it to use it in debug mode in the future when more WASI functions are implemented.

src/wasi/Wasi.cpp Outdated Show resolved Hide resolved
@kulcsaradam kulcsaradam force-pushed the wasi_errors branch 4 times, most recently from b41d5ed to 5324814 Compare September 5, 2023 08:31
Signed-off-by: Adam Laszlo Kulcsar <[email protected]>
Copy link
Collaborator

@clover2123 clover2123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@clover2123 clover2123 merged commit 1ad0053 into Samsung:interp Sep 6, 2023
11 checks passed
@kulcsaradam kulcsaradam deleted the wasi_errors branch September 7, 2023 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants