functional/no-try-statements
February 22, 2026 Β· View on GitHub
π Disallow try-catch[-finally] and try-finally patterns.
πΌπ« This rule is enabled in the following configs:
noExceptions, π strict. This rule is disabled in the following configs: βοΈ lite, β
recommended.
This rule disallows the try keyword.
Rule Details
Try statements are not part of functional programming. See no-throw-statements for more information.
β Incorrect
/* eslint functional/no-try-statements: "error" */
try {
doSomethingThatMightGoWrong(); // <-- Might throw an exception.
} catch (error) {
// Handle error.
}
β Correct
/* eslint functional/no-try-statements: "error" */
doSomethingThatMightGoWrong() // <-- Returns a Promise
.catch((error) => {
// Handle error.
});
Options
This rule accepts an options object of the following type:
type Options = {
allowCatch: boolean;
allowFinally: boolean;
};
Default Options
const defaults = {
allowCatch: false,
allowFinally: false,
};
allowCatch
If true, try-catch statements are allowed.
allowFinally
If true, try-finally statements are allowed.