Skip to content

Commit

Permalink
fix(cpp): returning correct error struct when the method is not suppo…
Browse files Browse the repository at this point in the history
…rted
  • Loading branch information
mateoguzmana committed Oct 8, 2024
1 parent 78fb39e commit de9a460
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cpp/react-native-lz4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,12 @@ namespace lz4
}
else
{
throw jsi::JSError(runtime, "Invalid mode. Use 'compress' or 'decompress'.");
return createJsResultObject(runtime, {
success : false,
message : "Invalid mode '" + mode + "', valid modes are 'compress' and 'decompress'",
originalSize : 0,
finalSize : 0
});
}

return createJsResultObject(runtime, fileOperationResult);
Expand Down

0 comments on commit de9a460

Please sign in to comment.