Analysis Error Handling

Analysis Error Handling

Hi

I handle my local errors like this
  1. async function Night(context, scope) {
  2.   try {
  3.     // ... (your existing Night function code)
  4.   } catch (error) {
  5.     context.log('Error in Night function:', error.message);
  6.   }
  7. }
  8. // The function myAnalysis will run when you execute your analysis
  9. async function myAnalysis(context, scope) {
  10. // ........... (existing code)

  11.   // function call
  12.   await Night(context, scope);

  13.   // ........... (existing code)
  14. }

  15. Analysis.use(myAnalysis);
When i try to handle global errors like this
  • async function Night(context, scope) {
  •   try {
  •     // ... (your existing Night function code)
  •   } catch (error) {
  •     context.log('Error in Night function:', error.message);
  •   }
  • }

  • async function startAnalysis(context, scope) {
  •   try {
  •     console.log("Running");

  •     // ........... (existing code)

  •     // function call
  •     await Night(context, scope);

  •     // ........... (existing code)

  •   } catch (error) {
  •     context.log(`Error in startAnalysis: ${error.message}`);
  •   }
  • }

  • module.exports = new Analysis(startAnalysis);

  • I get syntax error on 
    SyntaxError: Unexpected token 'catch' at Immediate.<anonymous> ([eval]:8:44) at process.processImmediate (node:internal/timers

    Can anyone give me some dirrection on this?
    I suspect that maybe, as this is a function within a larger program of TagoIO that the error handling on a global scale is handled their side.

  • Thanks