( condition: unknown, message: string )
| 32 | * In production, logs an error and continues. In all other environments, throws an error. |
| 33 | */ |
| 34 | export function assertDev( |
| 35 | condition: unknown, |
| 36 | message: string |
| 37 | ): asserts condition { |
| 38 | if (!condition) { |
| 39 | const err = new Error(message); |
| 40 | if (getEnvironment() !== Environment.PackagedApp) { |
| 41 | devDebugger(); |
| 42 | throw err; |
| 43 | } |
| 44 | log.error('failure:', Errors.toLogFormat(err)); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Throws an error if the condition is falsy, regardless of environment. |
no test coverage detected