(project: string)
| 502 | * @throws {FirebaseError} if project id has invalid format. |
| 503 | */ |
| 504 | export function validateProjectId(project: string): void { |
| 505 | if (PROJECT_ID_REGEX.test(project)) { |
| 506 | return; |
| 507 | } |
| 508 | trackGA4("error", { |
| 509 | error_type: "Error (User)", |
| 510 | details: "Invalid project ID", |
| 511 | }); |
| 512 | const invalidMessage = "Invalid project id: " + clc.bold(project) + "."; |
| 513 | if (project.toLowerCase() !== project) { |
| 514 | // Attempt to be more helpful in case uppercase letters are used. |
| 515 | throw new FirebaseError(invalidMessage + "\nNote: Project id must be all lowercase."); |
| 516 | } else { |
| 517 | throw new FirebaseError(invalidMessage); |
| 518 | } |
| 519 | } |
no test coverage detected
searching dependent graphs…