FCF 2.0 development in progress...
> > > >
[News] [Packages API] [Downloads] [Donate to the project] [Contacts]

fcf.parseError() function

[{message, fullMessage, stack, stackArr}] fcf.parseError(Error|fcf.Exception a_error)

Package: fcf-framework-core

File: fcf-framework-core:fcf.js

Available from version: 2.0.2

Parses error information from the Error object.

Arguments

Error|fcf.Exception a_error
- Error object
Result
[{message, fullMessage, stack, stackArr}]
- An object with information about the error. Object properties:
  • string message - An error message that includes only the error text without additional messages.

    string fullMessage - The full error message, which includes additional information about the stack.

    string stack - Text with a message about the stack.

    [object] stackArr - Array with objects about stack calls, containing the following fields

    • string file - JS file from which the call was made

    • string function - The name of the function that was called

    • number line - Line number in the file

    • number column - Column in file

Example: Function application

let error = fcf.parseError(new Error("Test error")); console.log(error);

Output:

{ message: 'Test error', fullMessage: 'Error: Test error\n', stackArr: [ { function: 'Object.test', line: '11', column: '30', file: '/home/user/application/parseStack.js' }, { function: 'fcf.Actions.<anonymous>', line: '615', column: '26', file: '/home/user/application/node_modules/fcf-framework-unitest/unitest.js' }, { function: 'fcf.Actions._execute', line: '3125', column: '24', file: '/home/user/application/node_modules/fcf-framework-core/fcf.js' }, ... ], stack: 'Object.test (/home/user/application/parseStack.js:11:30)\n' + 'fcf.Actions.<anonymous> (/home/user/application/node_modules/fcf-framework-unitest/unitest.js:615:26)\n' + 'fcf.Actions._execute (/home/user/application/node_modules/fcf-framework-core/fcf.js:3125:24)\n' + 'fcf.Actions.then (/home/user/application/node_modules/fcf-framework-core/fcf.js:2575:16)\n' + 'Namespace.Unitest._runLocalTests (/home/user/application/node_modules/fcf-framework-unitest/unitest.js:611:14)\n' + 'fcf.Actions.<anonymous> (/home/user/application/node_modules/fcf-framework-unitest/unitest.js:533:25)\n' + 'fcf.Actions._execute (/home/user/application/node_modules/fcf-framework-core/fcf.js:3130:24)\n' + 'Object.complete (/home/user/application/node_modules/fcf-framework-core/fcf.js:3089:18)\n' + ' (/home/user/application/node_modules/fcf-framework-core/fcf.js:3144:17)' }