add rules to prefer Error objects to be thrown and rejected (#54229)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54229

Changelog: [General][Added] Added eslint rule to warn when a non-error is being thrown from a function or rejected for a promise.

Reviewed By: huntie

Differential Revision: D85237916

fbshipit-source-id: e0e4fbc6b4620a19be1959d3953856c7e44ad4e0
This commit is contained in:
Vitali Zaidman
2025-10-23 06:42:55 -07:00
committed by meta-codesync[bot]
parent 9cadfe6607
commit 94995fdd9f
7 changed files with 20 additions and 9 deletions
@@ -30,5 +30,5 @@ export function takeScreenshot(
if (NativeModule != null) {
return NativeModule.takeScreenshot(id, options);
}
return Promise.reject();
return Promise.reject(new Error('ScreenshotManager is not defined.'));
}