-
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
Summary: Imported from static_h Original Author: [email protected] Original Git: 8b7a9f8 Original Reviewed By: avp Original Revision: D61870728 Look for stack data in the entire prototype chain in order to accommodate usage like the one in the test. See #1496 Reviewed By: fbmal7 Differential Revision: D62357838 fbshipit-source-id: 3873bfd8bcb5c16998dbec67f44ad4c098179758
- Loading branch information
1 parent
468f005
commit db6d12e
Showing
2 changed files
with
33 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,26 @@ | ||
/** | ||
* 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 | ||
|
||
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{{.*}} |