Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions templates/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,15 @@ export class {{ object_def.name() | typescript_class_name }} extends UniffiAbstr
let {{ arg.name() | typescript_argument_var_name }} = {{ arg.name() | typescript_var_name | typescript_ffi_converter_lower_with(arg.as_type().borrow()) }};
{% endfor -%}

const pointer = uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
const pointer = {%- match constructor_fn.throws_type() -%}
{%- when Some(err) -%}
uniffiCaller.rustCallWithError(
/*liftError:*/ (buffer) => ["{{err | typescript_type_name}}", {{err | typescript_ffi_converter_name}}.lift(buffer)],
/*caller:*/ (callStatus) => {
{%- else -%}
uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
{%- endmatch %}
return FFI_DYNAMIC_LIB.{{ constructor_fn.ffi_func().name() }}([
{% for arg in constructor_fn.arguments() -%}
{{ arg.name() | typescript_argument_var_name }}
Expand Down
2 changes: 1 addition & 1 deletion templates/sys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class UniffiFfiRsRustCaller {
function uniffiCheckCallStatus<ErrorEnumAndVariant extends [string, string]>(
callStatus: UniffiRustCallStatusStruct,
liftString: (bytes: UniffiByteArray) => string,
liftError?: (buffer: UniffiByteArray) => [string, string],
liftError?: (buffer: UniffiByteArray) => ErrorEnumAndVariant,
) {
switch (callStatus.code) {
case CALL_SUCCESS:
Expand Down