Skip to content

Commit ad541bb

Browse files
committed
fix: usage of Result type
1 parent e9a62d4 commit ad541bb

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/polywrap-plugin/polywrap_plugin/module.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async def __wrap_invoke__(self, method: str, args: Dict[str, Any], client: Invok
2121
methods: List[str] = [name for name in dir(self) if name == method]
2222

2323
if not methods:
24-
return Err(Exception(f"{method} is not defined in plugin"))
24+
return Err.from_str(f"{method} is not defined in plugin")
2525

2626
callable_method = getattr(self, method)
27-
return Ok(callable_method(args, client)) if callable(callable_method) else Err(Exception(f"{method} is an attribute, not a method"))
27+
return Ok(callable_method(args, client)) if callable(callable_method) else Err.from_str(f"{method} is an attribute, not a method")

packages/polywrap-plugin/polywrap_plugin/package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ async def create_wrapper(self) -> Result[Wrapper]:
2323
return Ok(PluginWrapper(module=self.module, manifest=self.manifest))
2424

2525
async def get_manifest(self, options: Optional[GetManifestOptions] = None) -> Result[AnyWrapManifest]:
26-
return await super().get_manifest(options)
26+
return Ok(self.manifest)

packages/polywrap-plugin/polywrap_plugin/wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async def invoke(
3838

3939

4040
async def get_file(self, options: GetFileOptions) -> Result[Union[str, bytes]]:
41-
return Err(Exception("client.get_file(..) is not implemented for plugins"))
41+
return Err.from_str("client.get_file(..) is not implemented for plugins")
4242

4343
def get_manifest(self) -> Result[AnyWrapManifest]:
4444
return Ok(self.manifest)

0 commit comments

Comments
 (0)