Skip to content

Commit

Permalink
chore(release): 1.69.0 (#3773)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Sep 27, 2022
2 parents b45f2f6 + 8984c12 commit f656c31
Show file tree
Hide file tree
Showing 31 changed files with 404 additions and 132 deletions.
18 changes: 18 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,24 @@
"contributions": [
"bug"
]
},
{
"login": "jmalins",
"name": "Jeff Malins",
"avatar_url": "https://avatars.githubusercontent.com/u/2001356?v=4",
"profile": "https://github.com/jmalins",
"contributions": [
"code"
]
},
{
"login": "andipabst",
"name": "Andi Pabst",
"avatar_url": "https://avatars.githubusercontent.com/u/9639382?v=4",
"profile": "https://github.com/andipabst",
"contributions": [
"bug"
]
}
],
"repoType": "github",
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ jobs:
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ matrix.dotnet }}
include-prerelease: ${{ matrix.dotnet-prerelease }}
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.69.0](https://github.com/aws/jsii/compare/v1.68.0...v1.69.0) (2022-09-27)


### Features

* **dotnet:** distinguish error types ([#3764](https://github.com/aws/jsii/issues/3764)) ([283dae5](https://github.com/aws/jsii/commit/283dae57647cb28323f4f02ef040deef81248f3a))


### Bug Fixes

* **jsii:** missing deprecation warning in collections ([#3756](https://github.com/aws/jsii/issues/3756)) ([72f2e7c](https://github.com/aws/jsii/commit/72f2e7ca82555c2dce647f873bed923a98808f95)), closes [#3755](https://github.com/aws/jsii/issues/3755)
* **kernel:** EPERM on rename operation on Windows ([#3769](https://github.com/aws/jsii/issues/3769)) ([bab1d38](https://github.com/aws/jsii/commit/bab1d388e8bed41c4930566ba5834acf57cc696c)), closes [#992](https://github.com/aws/jsii/issues/992) [#3724](https://github.com/aws/jsii/issues/3724) [#3751](https://github.com/aws/jsii/issues/3751)
* **python:** bin script python support, test argument passing ([#3762](https://github.com/aws/jsii/issues/3762)) ([0cf5008](https://github.com/aws/jsii/commit/0cf500864c918a799505625b08025293431031c7)), closes [#3694](https://github.com/aws/jsii/issues/3694)

## [1.68.0](https://github.com/aws/jsii/compare/v1.67.0...v1.68.0) (2022-09-22)


Expand Down
68 changes: 35 additions & 33 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gh-pages/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mkdocs~=1.3.1
mkdocs-awesome-pages-plugin~=2.8.0
mkdocs-material~=8.5.2
mkdocs-material~=8.5.3
mkdocs-git-revision-date-plugin~=0.3.2
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"rejectCycles": true
}
},
"version": "1.68.0"
"version": "1.69.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ public void Exceptions()
calc.Add(3);
Assert.Equal(23d, calc.Value);

Assert.Throws<JsiiException>(() => calc.Add(10));
Assert.Throws<JsiiError>(() => calc.Add(10));

calc.MaxValue = 40;
calc.Add(10);
Expand Down Expand Up @@ -491,7 +491,7 @@ public void AsyncOverrides_OverrideThrows()
{
AsyncVirtualMethodsChild obj = new AsyncVirtualMethodsChild();

JsiiException exception = Assert.Throws<JsiiException>(() => obj.CallMe());
JsiiError exception = Assert.Throws<JsiiError>(() => obj.CallMe());
Assert.Contains("Thrown by native code", exception.Message);
}

Expand Down Expand Up @@ -558,7 +558,7 @@ public void PropertyOverrides_Get_Throws()
{
SyncVirtualMethodsChild_Throws so = new SyncVirtualMethodsChild_Throws();

JsiiException exception = Assert.Throws<JsiiException>(() => so.RetrieveValueOfTheProperty());
JsiiError exception = Assert.Throws<JsiiError>(() => so.RetrieveValueOfTheProperty());
Assert.Contains("Oh no, this is bad", exception.Message);
}

Expand All @@ -576,7 +576,7 @@ public void PropertyOverrides_Set_Throws()
{
SyncVirtualMethodsChild_Throws so = new SyncVirtualMethodsChild_Throws();

JsiiException exception = Assert.Throws<JsiiException>(() => so.ModifyValueOfTheProperty("Hii"));
JsiiError exception = Assert.Throws<JsiiError>(() => so.ModifyValueOfTheProperty("Hii"));
Assert.Contains("Exception from overloaded setter", exception.Message);
}

Expand Down Expand Up @@ -624,7 +624,7 @@ public void SyncOverrides_CallsDoubleAsyncMethodFails()
SyncOverrides obj = new SyncOverrides();
obj.CallAsync = true;

Assert.Throws<JsiiException>(() => obj.CallerIsMethod());
Assert.Throws<JsiiError>(() => obj.CallerIsMethod());
}

[Fact(DisplayName = Prefix + nameof(SyncOverrides_CallsDoubleAsyncPropertyGetterFails))]
Expand All @@ -633,7 +633,7 @@ public void SyncOverrides_CallsDoubleAsyncPropertyGetterFails()
SyncOverrides obj = new SyncOverrides();
obj.CallAsync = true;

Assert.Throws<JsiiException>(() => obj.CallerIsProperty);
Assert.Throws<JsiiError>(() => obj.CallerIsProperty);
}

[Fact(DisplayName = Prefix + nameof(SyncOverrides_CallsDoubleAsyncPropertySetterFails))]
Expand All @@ -642,7 +642,7 @@ public void SyncOverrides_CallsDoubleAsyncPropertySetterFails()
SyncOverrides obj = new SyncOverrides();
obj.CallAsync = true;

Assert.Throws<JsiiException>(() => obj.CallerIsProperty = 12);
Assert.Throws<JsiiError>(() => obj.CallerIsProperty = 12);
}

[Fact(DisplayName = Prefix + nameof(TestInterfaces))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public RuntimeTests()
_sut = new Services.Runtime(_nodeProcessMock);
}

[Fact(DisplayName = Prefix + nameof(ThrowsJsiiExceptionWhenResponseNotReceived))]
public void ThrowsJsiiExceptionWhenResponseNotReceived()
[Fact(DisplayName = Prefix + nameof(ThrowsJsiiErrorWhenResponseNotReceived))]
public void ThrowsJsiiErrorWhenResponseNotReceived()
{
_nodeProcessMock.StandardOutput.ReadLine().ReturnsNull();

var ex = Assert.Throws<JsiiException>(() => _sut.ReadResponse());
var ex = Assert.Throws<JsiiError>(() => _sut.ReadResponse());
Assert.Equal("Child process exited unexpectedly!", ex.Message);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ internal static class CallbackExtensions
if (!converter.TryConvert(attribute.Parameters[paramIndex], requiredType, referenceMap,
request.Arguments![n], out var value))
{
throw new JsiiException($"Unable to convert {request.Arguments![n]} to {requiredType.Name}");
throw new JsiiError($"Unable to convert {request.Arguments![n]} to {requiredType.Name}");
}
if (attribute.Parameters[paramIndex].IsVariadic)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ private bool MakeProxy(Type interfaceType, bool force, [NotNullWhen(true)] out o
);
if (constructorInfo == null)
{
throw new JsiiException($"Could not find constructor to instantiate {proxyType.FullName}");
throw new JsiiError($"Could not find constructor to instantiate {proxyType.FullName}");
}

result = constructorInfo.Invoke(new object[]{ Reference.ForProxy() });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ internal static void Load(Assembly assembly)
.FirstOrDefault(name => name.EndsWith(".tgz", StringComparison.InvariantCultureIgnoreCase));
if (tarballResourceName == null)
{
throw new JsiiException("Cannot find embedded tarball resource in assembly " + assembly.GetName(), null);
throw new JsiiError("Cannot find embedded tarball resource in assembly " + assembly.GetName(), null);
}

IServiceProvider serviceProvider = ServiceContainer.ServiceProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

namespace Amazon.JSII.Runtime
{
public sealed class JsiiException : Exception
public abstract class JsiiException : Exception
{
public ErrorResponse? ErrorResponse { get; }
public Type? ExceptionType { get; }

internal JsiiException() : base()
{
Expand All @@ -26,4 +27,26 @@ internal JsiiException(ErrorResponse response, Exception? innerException)
ErrorResponse = response;
}
}

public sealed class JsiiError : JsiiException
{
internal JsiiError() : base()
{
}

internal JsiiError(string message) : base(message)
{
}

internal JsiiError(string message, Exception? innerException)
: base(message, innerException)
{
}

internal JsiiError(ErrorResponse response, Exception? innerException)
: base(response, innerException)
{
}

}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
using Newtonsoft.Json;
using System;
using System.Runtime.Serialization;

namespace Amazon.JSII.JsonModel.Api.Response
{
public enum ErrorResponseName
{
[EnumMember(Value = "@jsii/kernel.Fault")]
JsiiError,
[EnumMember(Value = "@jsii/kernel.RuntimeError")]
RuntimeException,
}

[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public sealed class ErrorResponse
{
Expand All @@ -17,5 +26,8 @@ public ErrorResponse(string error, string? stack = null)

[JsonProperty("stack", NullValueHandling = NullValueHandling.Ignore)]
public string? Stack { get; }

[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
public ErrorResponseName Name { get ; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void SendRequest<TRequest>(TRequest requestObject)
}
catch (IOException exception)
{
throw new JsiiException("Unexpected error communicating with jsii-runtime", exception);
throw new JsiiError("Unexpected error communicating with jsii-runtime", exception);
}
}

Expand All @@ -94,7 +94,7 @@ TResponse ReceiveResponse<TResponse>()
}
catch (IOException exception)
{
throw new JsiiException("Unexpected error communicating with jsii-runtime", exception);
throw new JsiiError("Unexpected error communicating with jsii-runtime", exception);
}
}

Expand All @@ -109,7 +109,12 @@ TResponse ReceiveResponse<TResponse>()
{
ErrorResponse errorResponse = responseObject.ToObject<ErrorResponse>()!;

throw new JsiiException(errorResponse, null);
if (errorResponse.Name.Equals(ErrorResponseName.JsiiError))
{
throw new JsiiError(errorResponse, null);
}

throw new Exception(errorResponse.Error);
}

if (typeof(TResponse).IsAssignableFrom(typeof(HelloResponse)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ internal interface ITypeCache
System.Type GetClassType(string fullyQualifiedName)
{
return TryGetClassType(fullyQualifiedName)
?? throw new JsiiException($"Unable to find class for jsii FQN \"{fullyQualifiedName}\"");
?? throw new JsiiError($"Unable to find class for jsii FQN \"{fullyQualifiedName}\"");
}

System.Type GetEnumType(string fullyQualifiedName)
{
return TryGetEnumType(fullyQualifiedName)
?? throw new JsiiException($"Unable to find enum for jsii FQN \"{fullyQualifiedName}\"");
?? throw new JsiiError($"Unable to find enum for jsii FQN \"{fullyQualifiedName}\"");
}

System.Type GetInterfaceType(string fullyQualifiedName)
{
return TryGetInterfaceType(fullyQualifiedName)
?? throw new JsiiException($"Unable to find interface for jsii FQN \"{fullyQualifiedName}\"");
?? throw new JsiiError($"Unable to find interface for jsii FQN \"{fullyQualifiedName}\"");
}

System.Type GetProxyType(string fullyQualifiedName)
{
return TryGetProxyType(fullyQualifiedName)
?? throw new JsiiException($"Unable to find proxy type for jsii FQN \"{fullyQualifiedName}\"");
?? throw new JsiiError($"Unable to find proxy type for jsii FQN \"{fullyQualifiedName}\"");
}

System.Type GetFrameworkType(TypeReference reference, bool isOptional);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ ConstructorInfo GetByRefConstructor()
ConstructorInfo? constructorInfo = type.GetConstructor(constructorFlags, null, new[] {typeof(ByRefValue)}, null);
if (constructorInfo == null)
{
throw new JsiiException($"Could not find constructor to initialize {type.FullName} with a {typeof(ByRefValue).FullName}");
throw new JsiiError($"Could not find constructor to initialize {type.FullName} with a {typeof(ByRefValue).FullName}");
}
return constructorInfo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public string ExtractResource(Assembly assembly, string resourceName, string bag
using var stream = assembly.GetManifestResourceStream(resourceName);
if (stream == null)
{
throw new JsiiException($"Cannot find embedded resource: {resourceName} in {String.Join(", ", assembly.GetManifestResourceNames())}", null);
throw new JsiiError($"Cannot find embedded resource: {resourceName} in {String.Join(", ", assembly.GetManifestResourceNames())}", null);
}

stream.CopyTo(output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public string ReadResponse()
var response = _nodeProcess.StandardOutput.ReadLine();
if (string.IsNullOrEmpty(response))
{
throw new JsiiException("Child process exited unexpectedly!");
throw new JsiiError("Child process exited unexpectedly!");
}

return response;
Expand Down
25 changes: 21 additions & 4 deletions packages/@jsii/kernel/src/kernel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2144,10 +2144,27 @@ defineTest('invokeBinScript() return output', (sandbox) => {
script: 'calc',
});

expect(result.stdout).toEqual('Hello World!\n');
expect(result.stderr).toEqual('');
expect(result.status).toEqual(0);
expect(result.signal).toBeNull();
expect(result).toMatchObject<api.InvokeScriptResponse>({
status: 0,
stdout: 'Hello World!\n',
stderr: '',
signal: null,
});
});

defineTest('invokeBinScript() accepts arguments', (sandbox) => {
const result = sandbox.invokeBinScript({
assembly: 'jsii-calc',
script: 'calc',
args: ['arg1', 'arg2'],
});

expect(result).toMatchObject<api.InvokeScriptResponse>({
status: 0,
stdout: 'Hello World!\n arguments: arg1, arg2\n',
stderr: '',
signal: null,
});
});

// =================================================================================================
Expand Down
Loading

0 comments on commit f656c31

Please sign in to comment.