* Derive a stable, snake_case issue code from an error's class name. * e.g. `BigQueryServiceAccountParseError` -> `big_query_service_account_parse_error`, * `SpannerServiceAccountParseError` -> `spanner_service_account_parse_error`.
(errorName: string)
| 75 | * `SpannerServiceAccountParseError` -> `spanner_service_account_parse_error`. |
| 76 | */ |
| 77 | function errorCodeFromName(errorName: string): string { |
| 78 | const code = errorName |
| 79 | // Insert separators between case transitions (e.g. "ServiceAccount" -> "Service_Account"). |
| 80 | .replace(/([a-z0-9])([A-Z])/g, '$1_$2') |
| 81 | .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2') |
| 82 | .toLowerCase() |
| 83 | return code || 'integration_env_var_error' |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Generate the SQL/connection environment variables for the given integrations and surface any |
no outgoing calls
no test coverage detected