Skip to content

Commit

Permalink
feat: Add newErrorWith and fix error message reader from Wasmer.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Sep 18, 2020
1 parent 1dd2c14 commit 6423ad4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions wasmer/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ type Error struct {
message string
}

func newError() *Error {
func newErrorWith(message string) *Error {
return &Error{
message: message,
}
}

func newErrorFromWasmer() *Error {
var errorLength = C.wasmer_last_error_length()

if errorLength == 0 {
Expand All @@ -29,7 +35,7 @@ func newError() *Error {
}

return &Error{
message: C.GoStringN(errorMessagePointer, errorLength),
message: C.GoStringN(errorMessagePointer, errorLength-1),
}
}

Expand Down

0 comments on commit 6423ad4

Please sign in to comment.