pepr
pepr copied to clipboard
Error warning is not readable
Environment
Device and OS: App version: Kubernetes distro being used: Other:
I think that no error object exists.
└─[0] <git:(main) > k run n --image=nginx -n pepr-demo
Warning: Action failed: Error: [object Object]
pod/n created
} catch (e) {
Log.warn(actionMetadata, `Action failed: (THE FIRST) ${JSON.stringify(e)}`);
updateStatus("warning");
// Annoying ts false positive
response.warnings = response.warnings || [];
response.warnings.push(`Action failed: (THE PUSH) ${JSON.stringify(e)}`);
switch (config.onError) {
case Errors.reject:
Log.error(actionMetadata, `Action failed:(THE CASE) ${JSON.stringify(e)}`);
response.result = "Pepr module configured to reject on error";
return response;
┌─[cmwylie19@Cases-MacBook-Pro] - [~/pepr/pepr-test-module] - [2024-05-07 02:00:48]
└─[0] <git:(main) > k apply -f capabilities
Warning: Action failed: (THE PUSH) {}
pod/nnns created
This is specifically in the mutate processor.
To reproduce, just do logging in the mutate callback. Stringify does not help here, there is not an error being thrown
When(a.Pod)
.IsCreatedOrUpdated()
.Mutate(async po => {
try {
let logs = await K8s(kind.Pod)
.InNamespace("pepr-demo")
.Logs(po.Raw.metadata!.name);
Log.info(logs.join("\n"));
} catch(e){
throw new Error("BAD!");
}
});