Skip to content

Commit

Permalink
feat(go-runtime): include error message when wrapping a @jsii/kernel.…
Browse files Browse the repository at this point in the history
…Fault (#4275)

I ran into this error message when developing a JSII compatible construct.

```
panic: JsiiError: @jsii/kernel.Fault
```

Including the de-serialized error message into the wrapped error helped me debug that I was missing the `.jsii` file in my distribution! (eg: I needed to add `".jsii"` to the `"files"` list in my construct's `package.json`)

```
panic: JsiiError: @jsii/kernel.Fault Error for package tarball /var/folders/<redacted>.tgz: Expected to find .jsii file in /var/folders/<redacted>/node_modules/<redacted>, but no such file found
```


---

By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
  • Loading branch information
bmoffatt authored Dec 15, 2023
1 parent c628cc8 commit c6eb62a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func (p *Process) readResponse(into interface{}) error {
json.Unmarshal(raw, &errResp)

if errResp.Name != nil && *errResp.Name == "@jsii/kernel.Fault" {
return fmt.Errorf("JsiiError: %s", *errResp.Name)
return fmt.Errorf("JsiiError: %s %s", *errResp.Name, errResp.Error)
}

return errors.New(errResp.Error)
Expand Down

0 comments on commit c6eb62a

Please sign in to comment.