From c6eb62a290b9a1897fe0aee6cb1a89581b0cd78b Mon Sep 17 00:00:00 2001 From: Bryan Moffatt Date: Fri, 15 Dec 2023 04:19:10 -0800 Subject: [PATCH] feat(go-runtime): include error message when wrapping a @jsii/kernel.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/.tgz: Expected to find .jsii file in /var/folders//node_modules/, 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 --- .../jsii-runtime-go/internal/kernel/process/process.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@jsii/go-runtime/jsii-runtime-go/internal/kernel/process/process.go b/packages/@jsii/go-runtime/jsii-runtime-go/internal/kernel/process/process.go index f437648f5c..4541c2a8e1 100644 --- a/packages/@jsii/go-runtime/jsii-runtime-go/internal/kernel/process/process.go +++ b/packages/@jsii/go-runtime/jsii-runtime-go/internal/kernel/process/process.go @@ -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)