0
Global / workspace error handler template
One script reply has been approved by the moderators Verified
Created by hugo697 282 days ago Viewed 3837 times
0
Submitted by hugo697 Deno
Verified 282 days ago
1
// Global / workspace error handler template
2

3
export async function main(
4
  path: string, // The path of the script or flow that errored
5
  email: string, // The email of the user who ran the script or flow that errored
6
  error: object, // The error details
7
  job_id: string, // The job id
8
  is_flow: boolean, // Whether the error comes from a flow
9
  workspace_id: string // The workspace id of the failed script or flow
10
) {
11
  const run_type = is_flow ? "flow" : "script";
12
  console.log(
13
    `An error occured with ${run_type} ${path} run by ${email} in workspace ${workspace_id}`
14
  );
15
  console.log(error);
16
  return error;
17
}
18