# E0118: unexpected 'finally' without 'try'

`try` statements can have a `finally` clause. It is a syntax error to have a `finally` clause with no corresponding `try` statement:

    let recursionDepth = 0;
    function recursionExample() {
      if (recursionDepth > 100) {
        throw new Error("too much recursion!");
      }
      recursionDepth += 1;
      try {
        recursionExample();
      };
      finally {
        recursionDepth -= 1;
      }
    }

To fix this error, make sure the `finally` keyword immediately follows the `}` for a `try` block or a `catch` block:

    let recursionDepth = 0;
    function recursionExample() {
      if (recursionDepth > 100) {
        throw new Error("too much recursion!");
      }
      recursionDepth += 1;
      try {
        recursionExample();
      }
      finally {
        recursionDepth -= 1;
      }
    }

Introduced in quick-lint-js version 0.2.0.

Documentation for other errors