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