( code: T, message: null | false | string, )
| 196 | * See additional info on the `message` argument type in the `RuntimeError` class description. |
| 197 | */ |
| 198 | export function formatRuntimeError<T extends number = RuntimeErrorCode>( |
| 199 | code: T, |
| 200 | message: null | false | string, |
| 201 | ): string { |
| 202 | const fullCode = formatRuntimeErrorCode(code); |
| 203 | |
| 204 | let errorMessage = `${fullCode}${message ? ': ' + message : ''}`; |
| 205 | |
| 206 | if (ngDevMode && code < 0) { |
| 207 | const addPeriodSeparator = !errorMessage.match(/[.,;!?\n]$/); |
| 208 | const separator = addPeriodSeparator ? '.' : ''; |
| 209 | errorMessage = `${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`; |
| 210 | } |
| 211 | return errorMessage; |
| 212 | } |
no test coverage detected
searching dependent graphs…