( error: unknown, )
| 10 | import { normalizeImportName } from './normalize' |
| 11 | |
| 12 | function parseStorageError( |
| 13 | error: unknown, |
| 14 | ): { code: string, message: string } | null { |
| 15 | if (!(error instanceof Error)) { |
| 16 | return null |
| 17 | } |
| 18 | |
| 19 | const separatorIndex = error.message.indexOf(':') |
| 20 | if (separatorIndex <= 0) { |
| 21 | return null |
| 22 | } |
| 23 | |
| 24 | return { |
| 25 | code: error.message.slice(0, separatorIndex), |
| 26 | message: error.message.slice(separatorIndex + 1).trim(), |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | function withSuffix(name: string, suffix: number): string { |
| 31 | return suffix === 0 ? name : `${name} ${suffix}` |
no outgoing calls
no test coverage detected