(severity, error)
| 6738 | * @param {Error} error |
| 6739 | */ |
| 6740 | const logError= (severity, error)=> { |
| 6741 | if( weaksetHas(errorsLogged, error)) { |
| 6742 | return; |
| 6743 | } |
| 6744 | const errorTag= tagError(error); |
| 6745 | weaksetAdd(errorsLogged, error); |
| 6746 | const subErrors= []; |
| 6747 | const messageLogArgs= takeMessageLogArgs(error); |
| 6748 | const noteLogArgsArray= takeNoteLogArgsArray( |
| 6749 | error, |
| 6750 | makeNoteCallback(severity)); |
| 6751 | |
| 6752 | // Show the error's most informative error message |
| 6753 | if( messageLogArgs=== undefined) { |
| 6754 | // If there is no message log args, then just show the message that |
| 6755 | // the error itself carries. |
| 6756 | // eslint-disable-next-line @endo/no-polymorphic-call |
| 6757 | baseConsole[severity]( `${errorTag}:`,error.message); |
| 6758 | }else { |
| 6759 | // If there is one, we take it to be strictly more informative than the |
| 6760 | // message string carried by the error, so show it *instead*. |
| 6761 | logErrorInfo( |
| 6762 | severity, |
| 6763 | error, |
| 6764 | ErrorInfo.MESSAGE, |
| 6765 | messageLogArgs, |
| 6766 | subErrors); |
| 6767 | |
| 6768 | } |
| 6769 | // After the message but before any other annotations, show the stack. |
| 6770 | let stackString= getStackString(error); |
| 6771 | if( |
| 6772 | typeof stackString=== 'string'&& |
| 6773 | stackString.length>= 1&& |
| 6774 | !stringEndsWith(stackString, '\n')) |
| 6775 | { |
| 6776 | stackString+= '\n'; |
| 6777 | } |
| 6778 | // eslint-disable-next-line @endo/no-polymorphic-call |
| 6779 | baseConsole[severity](stackString); |
| 6780 | // Show the other annotations on error |
| 6781 | for( const noteLogArgs of noteLogArgsArray) { |
| 6782 | logErrorInfo(severity, error, ErrorInfo.NOTE, noteLogArgs, subErrors); |
| 6783 | } |
| 6784 | // explain all the errors seen in the messages already emitted. |
| 6785 | logSubErrors(severity, subErrors, errorTag); |
| 6786 | }; |
| 6787 | |
| 6788 | const levelMethods= arrayMap(consoleLevelMethods, ([level, _])=> { |
| 6789 | /** |
no test coverage detected