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

toString() method from fcf.Exception class

string toString(boolean a_enableStack = false, boolean a_enableSubException = false, strign a_language = fcf.getContext().language || fcf.getConfiguration().defaultLanguage)

Package: fcf-framework-core

File: fcf-framework-core:fcf.js

Available from version: 2.0.2

Returns an error message

Arguments

boolean a_enableStack = false
- If equal to true, then information about the call stack is added to the error message

boolean a_enableSubException = boolean
- If equal to true, then the message object of the error that caused the creation of the object instance (from the exception property) is added to the error message.

string a_language = fcf.getContext().language || fcf.getConfiguration().defaultLanguage
- The language in which the error message will be generated
Result
string
- Error message

Example:

fcf.addException("TEST_EXCEPTION", "Test exception: @{{value}}@"); let error = new fcf.Exception("TEST_EXCEPTION", {value: 1}); console.log(error.toString(true));

Output:

Test exception: 1 Stack: Object.test (/home/user/projects/Exception.js:9:13) fcf.Actions. (/home/user/projects/node_module/fcf-framework-unitest/unitest.js:615:26) fcf.Actions._execute (/home/user/projects/node_module/fcf-framework-core/fcf.js:3127:24) fcf.Actions.then (/home/user/projects/node_module/fcf-framework-core/fcf.js:2575:16) Namespace.Unitest._runLocalTests (/home/user/projects/node_module/fcf-framework-unitest/unitest.js:611:14) fcf.Actions. (/home/user/projects/node_module/fcf-framework-unitest/unitest.js:533:25) fcf.Actions._execute (/home/user/projects/node_module/fcf-framework-core/fcf.js:3132:24) Object.complete (/home/user/project/node_modules/fcf-framework-core/fcf.js:3091:18) (/home/user/project/node_modules/fcf-framework-core/fcf.js:3146:17)