(result: ReturnType<typeof getDMMFRaw>)
| 60 | } |
| 61 | |
| 62 | function handleGetDmmfResult(result: ReturnType<typeof getDMMFRaw>): DMMF.Document { |
| 63 | if ('error' in result) { |
| 64 | debugErrorType(result) |
| 65 | switch (result.type) { |
| 66 | case 'wasm-error': |
| 67 | throw mapWasmPanicToGetDmmfError(result.error, result.reason) |
| 68 | case 'parse-json': |
| 69 | throw new GetDmmfError({ _tag: 'unparsed', message: result.error.message, reason: result.reason }) |
| 70 | default: |
| 71 | assertNever(result.type, 'Unknown getDmmf error type') |
| 72 | } |
| 73 | } else { |
| 74 | return result |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | function mapWasmPanicToGetDmmfError(error: Error | WasmPanic, reason: string): GetDmmfError { |
| 79 | /** |
no test coverage detected