-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JSError: look for stack data in the prototype chain (#1497)
Summary: Pull Request resolved: #1497 Look for stack data in the entire prototype chain in order to accommodate usage like the one in the test. See #1496 Reviewed By: avp Differential Revision: D61870728 fbshipit-source-id: 9a1008cddcd8a87f96363922691460aa7f85224a
- Loading branch information
1 parent
fd99ca5
commit 8b7a9f8
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// RUN: %hermes %s | %FileCheck --match-full-lines %s | ||
// RUN: %shermes -exec %s | %FileCheck --match-full-lines %s | ||
|
||
const MyError = function(message) { | ||
this.message = message; | ||
}; | ||
MyError.prototype = new Error; | ||
MyError.prototype.name = 'MyError'; | ||
|
||
|
||
try { | ||
throw new MyError('1234') | ||
} catch (e) { | ||
if (e instanceof Error) | ||
print("Caught Error", e.stack); | ||
else | ||
print("Caught non-Error"); | ||
} | ||
// CHECK: Caught Error MyError: 1234 | ||
// CHECK-NEXT: at global{{.*}} |