Skip to content

Commit

Permalink
Bring back logging for start/end invocation (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
slinkydeveloper authored Nov 4, 2024
1 parent f5a35da commit 4a74bb5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/restate-sdk/src/endpoint/handlers/generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ export class GenericHandler implements RestateHandler {
),
() => !coreVm.is_processing()
);
console.info("Starting invocation.");

// This promise is used to signal the end of the computation,
// which can be either the user returns a value,
Expand Down Expand Up @@ -317,14 +318,15 @@ export class GenericHandler implements RestateHandler {
.then((bytes) => {
coreVm.sys_write_output_success(bytes);
coreVm.sys_end();
console.info("Invocation completed successfully.");
})
.catch((e) => {
const error = ensureError(e);
if (
!(error instanceof RestateError) ||
error.code !== SUSPENDED_ERROR_CODE
) {
console.warn("Function completed with an error.\n", error);
console.warn("Invocation completed with an error.\n", error);
}

if (error instanceof TerminalError) {
Expand Down

0 comments on commit 4a74bb5

Please sign in to comment.