main
js 25 lines 664 Bytes
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @flow
8 */
9
10 // This file replaces DefaultPrepareStackTrace in Edge/Node Server builds.
11
12 function prepareStackTrace(
13 error: Error,
14 structuredStackTrace: CallSite[],
15 ): string {
16 const name = error.name || 'Error';
17 const message = error.message || '';
18 let stack = name + ': ' + message;
19 for (let i = 0; i < structuredStackTrace.length; i++) {
20 stack += '\n at ' + structuredStackTrace[i].toString();
21 }
22 return stack;
23 }
24
25 export default prepareStackTrace;