Workers error

Error 1101 always appears when creating a worker, but it works fine on the edit code page.

Hi there,

When a Cloudflare Worker encounters an exception (e.g. an error/condition that wasn’t properly handled) it can cause your visitors to see an 1101 Error which will be presented with an HTTP 500 status code. You can find more on invocation statuses.

You can easily handle exceptions in your Worker code by using statements such as try…catch to ensure that if an exception is thrown in your code then it will be caught and handled gracefully.

For example, wrapping code that could trigger an exception as follows:

try 
{
  // potential exception in this code block
  myfunction();
} 
catch (error) 
{
  // if an exception was thrown, catch the error in this block
  console.error(error);
}

f you have any other questions, I highly suggest you checking our Discord channel, where you will find a lot of talented programmers that will be glad to help you with your Worker.